# Use official Python 3.12 slim image FROM python:3.12-slim # Set environment variables ENV SQLALCHEMY_DATABASE_URI=postgresql+asyncpg://avnadmin:AVNS_W4PzkCRVJw0ASHFYc8i@pg-5cdc7c9-aryanjain19082002-7775.j.aivencloud.com:25607/defaultdb ENV PYTHONUNBUFFERED=1 ENV POETRY_VERSION=1.8.2 # Set work directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ curl \ build-essential \ libreoffice \ default-jre-headless \ fonts-dejavu \ fonts-liberation \ fontconfig \ xvfb \ dbus-x11 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Install Poetry RUN curl -sSL https://install.python-poetry.org | python3 - ENV PATH="/root/.local/bin:$PATH" # Copy only dependency files first to leverage Docker cache COPY pyproject.toml poetry.lock* /app/ # Install dependencies (without creating a virtualenv) RUN poetry config virtualenvs.create false \ && poetry install --no-interaction --no-ansi RUN mkdir -p /tmp/.config/libreoffice && \ chmod 755 /tmp/.config/libreoffice RUN mkdir -p /files && chmod 777 /files ENV HOME=/tmp \ TMPDIR=/tmp \ JAVA_HOME=/usr/lib/jvm/default-java # Copy the entire project COPY . /app/ # Expose the port Uvicorn will run on EXPOSE 7860 # Run the FastAPI application CMD ["uvicorn", "src.app:app", "--reload", "--host", "0.0.0.0", "--port", "7860"]