debug-env / Dockerfile
hugsbun's picture
feat: complete debugging workflow with HuggingFace Inference API and OpenEnv Stage 1
2058884
Raw
History Blame Contribute Delete
1.39 kB
ARG BASE_IMAGE=ghcr.io/meta-pytorch/openenv-base:latest
FROM ${BASE_IMAGE} AS builder
WORKDIR /app
RUN apt-get update && \
apt-get install -y --no-install-recommends git && \
rm -rf /var/lib/apt/lists/*
# Copy lock files first β€” maximises layer cache on dependency-only changes
COPY pyproject.toml uv.lock ./
# Ensure uv is available
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; \
fi
# Install dependencies (not the project itself yet) β€” cached layer
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-install-project --no-editable
# Copy full source and install the project package
COPY . /app
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-editable --extra dev
# ── Runtime stage ──────────────────────────────────────────────────────────────
FROM ${BASE_IMAGE}
WORKDIR /app
COPY --from=builder /app/.venv /app/.venv
COPY --from=builder /app /app
ENV PATH="/app/.venv/bin:$PATH"
ENV PYTHONPATH="/app:$PYTHONPATH"
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
CMD ["bash", "start.sh"]