Spaces:
Runtime error
Runtime error
File size: 920 Bytes
00d5ae5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # Runtime image for HF Spaces (Docker SDK, cpu-basic) and GHCR.
# Heavy ML deps (torch, transformers) are deliberately absent until M1,
# and training deps never enter this image (see docs/adr/0001).
FROM python:3.12-slim-bookworm
# uv — pinned to the same version as local dev
COPY --from=ghcr.io/astral-sh/uv:0.11.20 /uv /uvx /bin/
ENV UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
UV_PYTHON_DOWNLOADS=never \
PYTHONUNBUFFERED=1
# Non-root user with uid 1000 (Hugging Face Spaces requirement)
RUN useradd -m -u 1000 app
WORKDIR /app
# Layer 1: dependencies only (cached as long as pyproject/uv.lock don't change)
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-install-project --no-dev
# Layer 2: project code
COPY README.md ./
COPY src ./src
RUN uv sync --frozen --no-dev && chown -R app:app /app
USER app
ENV PATH="/app/.venv/bin:$PATH"
EXPOSE 7860
CMD ["python", "-m", "tutor.app.main"]
|