-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.test
More file actions
57 lines (46 loc) · 2.22 KB
/
Copy pathDockerfile.test
File metadata and controls
57 lines (46 loc) · 2.22 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Dockerfile.test - Python-only test environment matching CI
#
# Lightweight image for running unit + guardrail tests.
# No R, no Node.js — Python dependencies only.
#
# Build: DOCKER_BUILDKIT=1 docker build -f Dockerfile.test -t foundation-plr-test .
# Run: docker run --rm -e MPLBACKEND=Agg foundation-plr-test
#
# =============================================================================
# --- Builder stage: install Python deps ---
# Pinned 2026-02-13 for reproducibility (TRIPOD-Code area B)
FROM python:3.11-slim-bookworm@sha256:067222884359a2476ff344f92278df8fbe4792b7cf1a43d82d4a98befe8f89fb AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential git libgomp1 && rm -rf /var/lib/apt/lists/*
# Pinned 2026-02-13 for reproducibility
COPY --from=ghcr.io/astral-sh/uv:0.9@sha256:e96d483a9ed7924d2acf01bdd1d537d0d5e6d8f21b74fff3373005f6c9446696 /uv /usr/local/bin/uv
WORKDIR /project
COPY pyproject.toml uv.lock ./
ENV UV_PROJECT_ENVIRONMENT=/opt/venv
RUN --mount=type=cache,target=/root/.cache/uv \
uv venv /opt/venv && uv sync --frozen --dev
# --- Final stage: slim runtime ---
# Pinned 2026-02-13 for reproducibility (TRIPOD-Code area B)
FROM python:3.11-slim-bookworm@sha256:067222884359a2476ff344f92278df8fbe4792b7cf1a43d82d4a98befe8f89fb
RUN apt-get update && apt-get install -y --no-install-recommends \
git libgomp1 && rm -rf /var/lib/apt/lists/*
# Pinned 2026-02-13 for reproducibility
COPY --from=ghcr.io/astral-sh/uv:0.9@sha256:e96d483a9ed7924d2acf01bdd1d537d0d5e6d8f21b74fff3373005f6c9446696 /uv /usr/local/bin/uv
COPY --from=builder /opt/venv /opt/venv
ENV VIRTUAL_ENV=/opt/venv PATH="/opt/venv/bin:$PATH"
ENV PYTHONPATH=/project/src PREFECT_DISABLED=1 MPLBACKEND=Agg
WORKDIR /project
COPY pyproject.toml uv.lock Makefile renv.lock .Rprofile ./
COPY .gitignore AGENTS.md ARCHITECTURE.md ./
COPY .github/ .github/
COPY src/ src/
COPY tests/ tests/
COPY configs/ configs/
COPY scripts/ scripts/
COPY docs/ docs/
COPY data/r_data/ data/r_data/
COPY data/public/ data/public/
RUN mkdir -p figures/generated
CMD ["python", "-m", "pytest", "tests/", "-m", "unit or guardrail", \
"--ignore=tests/test_docker_r.py", "--ignore=tests/test_docker_full.py", \
"-n", "auto", "-v", "--tb=short"]