Parallelize API tests and build, gate publish on test pass
Same pattern as the frontend pipeline: build pushes to a staging tag (build-N) in parallel with tests. Tests split into unit and integration shards using a shared venv from the workspace. Publish step uses skopeo to copy the manifest to final tags (:N, :latest, :builder) only after all tests and the build succeed. Named the final Dockerfile stage 'production' so target skips the test stage.
This commit is contained in:
parent
68e7f2a334
commit
0bb7e4c723
2 changed files with 60 additions and 6 deletions
|
|
@ -21,7 +21,7 @@ COPY requirements.txt ./
|
|||
# Install dependencies into a venv using uv (10-25x faster than pip)
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
python -m venv /app/.venv && \
|
||||
/app/.venv/bin/uv pip install -r requirements.txt
|
||||
uv pip install --python /app/.venv/bin/python -r requirements.txt
|
||||
|
||||
# Stage 2: Runtime system dependencies (runs in parallel with builder)
|
||||
FROM python:3.13-slim AS runtime-base
|
||||
|
|
@ -53,7 +53,7 @@ COPY . .
|
|||
RUN pytest tests/ -x -q
|
||||
|
||||
# Stage 4: Final image — combine venv from builder + runtime base
|
||||
FROM runtime-base
|
||||
FROM runtime-base AS production
|
||||
|
||||
RUN adduser --system --no-create-home appuser
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue