Files
2026-09-08 10:59:05 +02:00

28 lines
980 B
Docker

FROM python:3.11-slim
WORKDIR /app
# Bring in the uv binary from Astral's official image (pinned-ish, reproducible)
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# Compile bytecode for faster cold starts; install into a project-local
# venv at /app/.venv and put it on PATH so `python` resolves to it directly
# (this replaces `poetry config virtualenvs.create false`).
ENV UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:$PATH"
# --- Dependency layer: cached unless these files change ---
COPY pyproject.toml uv.lock ./
# --no-dev installs only the main deps (equivalent to poetry --only main).
# --frozen fails the build instead of silently re-resolving if uv.lock is stale.
RUN uv sync --no-dev --frozen
# --- Application layer ---
COPY . .
# Normalize line endings and make the entrypoint executable
RUN sed -i 's/\r$//' /app/entrypoint.sh \
&& chmod +x /app/entrypoint.sh
ENTRYPOINT ["/app/entrypoint.sh"]