| |
| FROM python:3.12-slim AS builder |
|
|
| |
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ |
|
|
| WORKDIR /api |
|
|
| |
| ENV PYTHONDONTWRITEBYTECODE=1 |
| ENV PYTHONUNBUFFERED=1 |
|
|
| |
| COPY uv.lock pyproject.toml ./ |
|
|
| |
| RUN --mount=type=cache,target=/root/.cache/uv \ |
| uv sync --no-install-project --no-editable |
|
|
| |
| COPY . . |
|
|
| |
| RUN --mount=type=cache,target=/root/.cache/uv \ |
| uv sync --no-editable |
|
|
|
|
| |
| FROM python:3.12-slim |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| chromium \ |
| curl \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ |
|
|
| WORKDIR /api |
|
|
| |
| COPY --from=builder /api/.venv /api/.venv |
| COPY --from=builder /api /api |
|
|
| |
| ENV PATH="/api/.venv/bin:$PATH" |
| ENV PYTHONDONTWRITEBYTECODE=1 |
| ENV PYTHONUNBUFFERED=1 |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| ENV CUDA_VISIBLE_DEVICES="" |
| ENV TF_ENABLE_ONEDNN_OPTS=0 |
|
|
|
|
| |
| HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \ |
| CMD curl -f http://localhost:7860/api/v1/health/liveness || exit 1 |
|
|
| |
| CMD ["uv", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |
|
|