81 lines
3.1 KiB
Docker
81 lines
3.1 KiB
Docker
# CI test image for pyWebLayout
|
|
# Build: docker build -f Dockerfile.ci -t gitea.tourolle.paris/dtourolle/pyweblayout-ci:latest .
|
|
# Push: docker push gitea.tourolle.paris/dtourolle/pyweblayout-ci:latest
|
|
#
|
|
# pyWebLayout is a library, so CI tests every interpreter pyproject.toml claims
|
|
# to support rather than just one. All four are in this image and the workflow
|
|
# matrix picks one per job; dependencies are pre-installed into each, so a CI
|
|
# run downloads nothing.
|
|
FROM ubuntu:24.04
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
# deadsnakes carries the Python versions Ubuntu 24.04 does not ship
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ca-certificates \
|
|
gnupg \
|
|
software-properties-common \
|
|
&& add-apt-repository -y ppa:deadsnakes/ppa \
|
|
&& apt-get update && apt-get install -y --no-install-recommends \
|
|
# Interpreters. 3.12 is Ubuntu 24.04's own; the rest come from deadsnakes.
|
|
python3.10 python3.10-venv \
|
|
python3.11 python3.11-venv \
|
|
python3.12 python3.12-venv \
|
|
python3.13 python3.13-venv \
|
|
# Pillow needs these at runtime for font rasterisation and image IO
|
|
libfreetype6 \
|
|
libjpeg-turbo8 \
|
|
libopenjp2-7 \
|
|
libtiff6 \
|
|
zlib1g \
|
|
# Used by the workflow itself
|
|
curl \
|
|
git \
|
|
nodejs \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# One venv per interpreter at a predictable path, /opt/py<version>. Ubuntu marks
|
|
# its system Python externally-managed, so installing into venvs sidesteps that
|
|
# without --break-system-packages, and keeps the four dependency sets isolated.
|
|
#
|
|
# The package list is written once so versions cannot drift between
|
|
# interpreters. It mirrors pyproject.toml's runtime deps plus the test and dev
|
|
# extras; keep the two in step.
|
|
#
|
|
# Deliberately NOT installed: pyWebLayout itself. The workflow installs the
|
|
# checkout with --no-deps, so a job always tests the code under review.
|
|
#
|
|
# setuptools is pinned below 81 because that release dropped pkg_resources,
|
|
# which coverage-badge still imports at startup. Without the pin the badge step
|
|
# dies with ModuleNotFoundError. Revisit when coverage-badge stops using it.
|
|
RUN for v in 3.10 3.11 3.12 3.13; do \
|
|
python$v -m venv /opt/py$v && \
|
|
/opt/py$v/bin/pip install --no-cache-dir --upgrade pip wheel && \
|
|
/opt/py$v/bin/pip install --no-cache-dir --upgrade "setuptools<81" && \
|
|
/opt/py$v/bin/pip install --no-cache-dir \
|
|
Pillow \
|
|
numpy \
|
|
pyphen \
|
|
beautifulsoup4 \
|
|
lxml \
|
|
pytest \
|
|
pytest-cov \
|
|
flask \
|
|
werkzeug \
|
|
ebooklib \
|
|
requests \
|
|
flake8 \
|
|
coverage-badge \
|
|
interrogate \
|
|
; \
|
|
done
|
|
|
|
# Fail the build rather than ship an image whose dependencies do not import
|
|
RUN for v in 3.10 3.11 3.12 3.13; do \
|
|
echo "--- python$v ---" && \
|
|
/opt/py$v/bin/python -c \
|
|
"import sys, PIL, numpy, pyphen, bs4, pytest, flask, ebooklib, requests; \
|
|
print(sys.version.split()[0], 'deps OK')" \
|
|
; \
|
|
done
|