# Multi-stage build for Demo Session Service FROM python:3.11-slim as builder WORKDIR /app # Install build dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ g++ \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install COPY services/demo_session/requirements.txt . RUN pip install --no-cache-dir --user -r requirements.txt # Final stage FROM python:3.11-slim WORKDIR /app # Copy Python dependencies from builder COPY --from=builder /root/.local /root/.local # Copy shared libraries COPY shared/ /app/shared/ # Copy service code COPY services/demo_session/ /app/ # Copy scripts COPY scripts/ /app/scripts/ # Make sure scripts are in path ENV PATH=/root/.local/bin:$PATH ENV PYTHONPATH=/app:$PYTHONPATH # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ CMD python -c "import httpx; httpx.get('http://localhost:8000/health')" # Run the application CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]