FROM python:3.12-slim as builder WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential gcc \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt . RUN pip install --user --no-cache-dir \ --extra-index-url https://download.pytorch.org/whl/cpu \ -r requirements.txt # Production stage — backend only FROM python:3.12-slim WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends curl \ && rm -rf /var/lib/apt/lists/* COPY --from=builder /root/.local /root/.local ENV PATH=/root/.local/bin:$PATH ENV SPACE_URL=https://fredyhoundayi-quick.hf.space # Copy only backend files (no frontend) COPY main.py . COPY requirements.txt . COPY services/ ./services/ COPY utils/ ./utils/ RUN mkdir -p /app/storage/chroma /app/storage/memory EXPOSE 8000 HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ CMD curl -f http://localhost:8000/ || exit 1 CMD ["python", "main.py"]