# Test phase. Both pytest runs share one 90-second timeout, so a hang # uses it once and gets no rerun. # debian:trixie-slim, YYYY-MM-DD FROM debian@sha256:... AS test # Python, pip and venv come from the distribution, which is trusted, so # they need no version and no hash. make and git are base tools that # script/bootstrap installs when they are missing. Installed here, they # stay in their own layer when script/ changes. RUN apt-get update \ && apt-get install -y --no-install-recommends ca-certificates make git \ python3 python3-venv \ && rm -rf /var/lib/apt/lists/* # script/bootstrap installs pipenv in a virtual environment at # $HOME/.pipenv, and the tests below run that pipenv. ENV PATH=/root/.pipenv/bin:$PATH WORKDIR /app COPY script/ script/ COPY Pipfile Pipfile.lock ./ RUN script/bootstrap ARG CACHEBUST COPY . . RUN timeout 90 sh -c 'pipenv run pytest || { \ echo "--- Rerunning with -v for details ---"; \ pipenv run pytest -v; exit 1; }'