| ARG BASE_IMAGE=ghcr.io/huggingface/openenv-base:latest | |
| FROM ${BASE_IMAGE} AS builder | |
| WORKDIR /app/env | |
| COPY . /app/env | |
| RUN if ! command -v uv >/dev/null 2>&1; then \ | |
| curl -LsSf https://astral.sh/uv/install.sh | sh && \ | |
| mv /root/.local/bin/uv /usr/local/bin/uv && \ | |
| mv /root/.local/bin/uvx /usr/local/bin/uvx; \ | |
| fi | |
| RUN --mount=type=cache,target=/root/.cache/uv uv sync --frozen --no-editable | |
| FROM ${BASE_IMAGE} | |
| WORKDIR /app/env | |
| COPY --from=builder /app/env /app/env | |
| ENV PATH="/app/env/.venv/bin:$PATH" | |
| ENV PYTHONPATH="/app/env:$PYTHONPATH" | |
| HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \ | |
| CMD curl -f http://localhost:8000/health || exit 1 | |
| ENV ENABLE_WEB_INTERFACE=true | |
| CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "8000"] | |