# Multi-stage Dockerfile to keep final image small FROM python:3.10-slim AS builder # Install build-time packages and Python dependencies in one layer WORKDIR /app COPY requirements.txt /app/requirements.txt RUN echo 'Acquire::http::Proxy "http://192.168.88.14:3142";' > /etc/apt/apt.conf.d/90proxy RUN apt-get update \ && apt-get install -y --no-install-recommends build-essential gcc libpq-dev \ && python -m pip install --upgrade pip \ && pip install --no-cache-dir --prefix=/install -r /app/requirements.txt \ && apt-get purge -y --auto-remove build-essential gcc \ && rm -rf /var/lib/apt/lists/* FROM python:3.10-slim WORKDIR /app # Copy installed packages from builder COPY --from=builder /install /usr/local # Production environment variables COPY .env /app/.env # Copy application code COPY . /app # Expose service port EXPOSE 8000 # Run the FastAPI app with uvicorn CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]