Spaces:
Sleeping
Sleeping
Download Dockerfile from hashir-qt/tasklert-api: direct link, hf CLI and curl.
- Browser
- Download file 2.08 kB
-
https://huggingface.co/spaces/hashir-qt/tasklert-api/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/hashir-qt/tasklert-api/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/hashir-qt/tasklert-api/resolve/main/Dockerfile
2.08 kB
| # ============================================================================= | |
| # Backend Dockerfile - Multi-stage build for FastAPI + OpenAI Agents SDK | |
| # Task: T009 [US1] - Phase IV Local Kubernetes Deployment | |
| # Spec: specs/006-phase4-k8s-deployment/spec.md (FR-001, FR-010) | |
| # ============================================================================= | |
| # ----------------------------------------------------------------------------- | |
| # Stage 1: Builder - Install dependencies with uv | |
| # ----------------------------------------------------------------------------- | |
| FROM python:3.13-slim AS builder | |
| WORKDIR /app | |
| # Install uv for fast dependency resolution | |
| RUN pip install --no-cache-dir uv | |
| # Copy dependency files | |
| COPY pyproject.toml ./ | |
| COPY uv.lock ./ | |
| # Copy source code (required for local package build) | |
| COPY src ./src | |
| # Create virtual environment and install dependencies (no dev deps) | |
| RUN uv sync --frozen --no-dev | |
| # ----------------------------------------------------------------------------- | |
| # Stage 2: Runtime - Minimal production image | |
| # ----------------------------------------------------------------------------- | |
| FROM python:3.13-slim AS runtime | |
| WORKDIR /app | |
| # Create non-root user for security | |
| RUN groupadd --gid 1000 appgroup && \ | |
| useradd --uid 1000 --gid appgroup --shell /bin/bash appuser | |
| # Copy virtual environment from builder | |
| COPY --from=builder /app/.venv /app/.venv | |
| # Copy application source code | |
| COPY src ./src | |
| # Set PATH to use virtual environment | |
| ENV PATH="/app/.venv/bin:$PATH" | |
| # Environment variables (overridden by K8s ConfigMap/Secret) | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| # Change ownership to non-root user | |
| RUN chown -R appuser:appgroup /app | |
| # Switch to non-root user | |
| USER appuser | |
| # Expose FastAPI port | |
| EXPOSE 8000 | |
| # Health check (FR-006) | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ | |
| CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1 | |
| # Run uvicorn server | |
| CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000"] | |