FROM python:3.11-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ git \ curl \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies COPY requirements.txt /app/server/requirements.txt RUN pip install --no-cache-dir -r /app/server/requirements.txt # Copy the self-contained server package COPY . /app/server # Set environment variables ENV PYTHONUNBUFFERED=1 ENV HOST=0.0.0.0 ENV PORT=8000 ENV WORKERS=1 ENV MAX_CONCURRENT_ENVS=16 # Health check HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \ CMD curl -f http://localhost:${PORT}/health || exit 1 # Run FastAPI app EXPOSE ${PORT} CMD ["python", "-m", "server.app"]