polyglot-tutor / Dockerfile
blizzarman's picture
feat: M0 walking skeleton (app, service protocols, CI/CD, Space deploy)
00d5ae5
Raw
History Blame Contribute Delete
920 Bytes
# 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"]