-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (25 loc) · 1.28 KB
/
Dockerfile
File metadata and controls
37 lines (25 loc) · 1.28 KB
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
33
34
35
36
37
# ── Builder ──────────────────────────────────────────────────────────────────
FROM python:3.14-slim AS builder
RUN pip install --no-cache-dir uv
ENV UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
UV_PYTHON_DOWNLOADS=never
WORKDIR /app
# Install dependencies first — this layer is cached until lockfile changes
# README.md is required by pyproject.toml's readme field during package build
COPY pyproject.toml uv.lock README.md ./
RUN uv sync --frozen --no-dev --no-install-project
# Install the project itself (source baked into venv via --no-editable)
COPY src/ ./src/
RUN uv sync --frozen --no-dev --no-editable
# ── Runtime ───────────────────────────────────────────────────────────────────
FROM python:3.14-slim
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PATH="/app/.venv/bin:$PATH"
RUN groupadd --system --gid 1001 app \
&& useradd --system --uid 1001 --gid 1001 --no-create-home app
WORKDIR /app
COPY --from=builder --chown=app:app /app/.venv /app/.venv
USER app
CMD ["docker-python-env"]