Download production/Dockerfile.prod from raazkumar/ml-intern-local-fork: direct link, hf CLI and curl.
- Browser
- Download file 1.19 kB
-
https://huggingface.co/raazkumar/ml-intern-local-fork/resolve/main/production/Dockerfile.prod
- Command line
-
hf download hf://raazkumar/ml-intern-local-fork/production/Dockerfile.prod
-
curl -L -o Dockerfile.prod https://huggingface.co/raazkumar/ml-intern-local-fork/resolve/main/production/Dockerfile.prod
1.19 kB
| FROM python:3.11-slim AS builder | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| gcc libpq-dev curl && rm -rf /var/lib/apt/lists/* | |
| # Install uv | |
| RUN curl -LsSf https://astral.sh/uv/install.sh | sh | |
| ENV PATH="/root/.local/bin:$PATH" | |
| WORKDIR /app | |
| COPY pyproject.toml . | |
| COPY production/ ./production/ | |
| # Sync dependencies with uv | |
| RUN uv sync --frozen | |
| FROM python:3.11-slim AS production | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| libpq5 curl && rm -rf /var/lib/apt/lists/* | |
| # Install uv in production too | |
| RUN curl -LsSf https://astral.sh/uv/install.sh | sh | |
| ENV PATH="/root/.local/bin:$PATH" | |
| RUN useradd --create-home --shell /bin/bash appuser | |
| WORKDIR /app | |
| COPY --from=builder /app/.venv /app/.venv | |
| COPY --chown=appuser:appuser production/ ./production/ | |
| COPY --chown=appuser:appuser pyproject.toml . | |
| ENV PATH="/app/.venv/bin:$PATH" | |
| ENV PYTHONPATH="/app" | |
| RUN chown -R appuser:appuser /app | |
| USER appuser | |
| EXPOSE 8000 | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ | |
| CMD curl -f http://localhost:8000/health || exit 1 | |
| CMD ["uvicorn", "production.production_server:app", "--host", "0.0.0.0", "--port", "8000"] | |