/ Dockerfile
Dockerfile
1 FROM python:3.12-slim 2 3 WORKDIR /app 4 5 # Install system dependencies 6 RUN apt-get update && apt-get install -y \ 7 gcc g++ curl \ 8 && rm -rf /var/lib/apt/lists/* 9 10 # Install uv 11 RUN curl -Ls https://astral.sh/uv/install.sh | sh 12 ENV PATH="/root/.cargo/bin:$PATH" 13 14 # Copy dependency files 15 COPY pyproject.toml uv.lock ./ 16 17 # Install dependencies (reproducible build) 18 RUN uv sync --system --no-cache 19 20 21 # Copy application 22 COPY . . 23 24 # Create non-root user 25 RUN useradd -m -u 1000 appuser && \ 26 chown -R appuser:appuser /app 27 28 USER appuser 29 30 EXPOSE 8000 31 32 HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ 33 CMD curl -f http://localhost:8000/health || exit 1 34 35 CMD ["uvicorn", "src.fastapi_api:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "4"]