|
| 1 | +# Dockerfile for Testing Plot Correctness |
| 2 | +# |
| 3 | +# This Dockerfile is used to create a consistent testing environment for |
| 4 | +# verifying the correctness of plot outputs against ground truth images. |
| 5 | +# The ground truth images are stored in `tests/_images` and are generated |
| 6 | +# using a GitHub Action on Ubuntu. This ensures consistency across different |
| 7 | +# environments, as local differences in OS or library versions can cause |
| 8 | +# slight variations in plot rendering (e.g., ticks or padding). |
| 9 | + |
| 10 | +# Define a build argument for the target platform. |
| 11 | +# Default is set to linux/amd64 for x86_64 machines. |
| 12 | +ARG TARGETPLATFORM=linux/amd64 |
| 13 | + |
| 14 | +# Use the specified platform to pull the correct base image. |
| 15 | +# Override TARGETPLATFORM during build for different architectures, such as linux/arm64 for Apple Silicon. |
| 16 | +# For example, to build for ARM64 architecture (e.g., Apple Silicon), |
| 17 | +# use the following command on the command line: |
| 18 | +# |
| 19 | +# docker build --build-arg TARGETPLATFORM=linux/arm64 -t my-arm-image . |
| 20 | +# |
| 21 | +# Similarly, to build for the default x86_64 architecture, you can use: |
| 22 | +# |
| 23 | +# docker build --build-arg TARGETPLATFORM=linux/amd64 -t my-amd64-image . |
| 24 | +# |
| 25 | +FROM --platform=$TARGETPLATFORM ubuntu:latest |
| 26 | +LABEL authors="Luca Marconato" |
| 27 | + |
| 28 | +ENV PYTHONUNBUFFERED=1 |
| 29 | +ENV MPLBACKEND=agg |
| 30 | + |
| 31 | +WORKDIR /spatialdata-plot |
| 32 | +COPY . /spatialdata-plot |
| 33 | + |
| 34 | +RUN apt-get update && \ |
| 35 | + apt-get install -y --no-install-recommends \ |
| 36 | + build-essential \ |
| 37 | + python3-venv \ |
| 38 | + python3-dev \ |
| 39 | + git \ |
| 40 | + && rm -rf /var/lib/apt/lists/* |
| 41 | + |
| 42 | +RUN python3 -m venv /opt/venv |
| 43 | +ENV PATH="/opt/venv/bin:$PATH" |
| 44 | +RUN pip install --upgrade pip wheel |
| 45 | + |
| 46 | +RUN pip install -e ".[dev,test]" |
| 47 | + |
| 48 | +CMD ["pytest", "-v", "tests/pl/test_render.py"] |
0 commit comments