Skip to content

Commit 942dcd4

Browse files
CI: Parameterize Python version in cross-arch Dockerfile
The python version in the Dockerfile for the arm64 cross-arch tests is now parameterized to pass the python version as an argument so that only one Dockerfile is needed for all python versions. Signed-off-by: Daniel Zullo <[email protected]>
1 parent fab8bd5 commit 942dcd4

File tree

3 files changed

+10
-39
lines changed

3 files changed

+10
-39
lines changed

.github/containers/nox-cross-arch/arm64-ubuntu-20.04-python-3.12.Dockerfile

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/containers/nox-cross-arch/arm64-ubuntu-20.04-python-3.11.Dockerfile renamed to .github/containers/nox-cross-arch/arm64-ubuntu-20.04-python.Dockerfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55

66
FROM docker.io/library/ubuntu:20.04
77

8+
ARG PYTHON_VERSION="3.11"
9+
810
ENV DEBIAN_FRONTEND=noninteractive
911

10-
# Install Python 3.11 and curl to install pip later
12+
# Install Python and curl to install pip later
1113
RUN apt-get update -y && \
1214
apt-get install --no-install-recommends -y \
1315
software-properties-common && \
@@ -16,16 +18,16 @@ RUN apt-get update -y && \
1618
ca-certificates \
1719
curl \
1820
git \
19-
python3.11 \
20-
python3.11-distutils && \
21+
python${PYTHON_VERSION} \
22+
python${PYTHON_VERSION}-distutils && \
2123
apt-get clean && \
2224
rm -rf /var/lib/apt/lists/*
2325

2426
# Install pip
25-
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11
27+
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION}
2628

2729
RUN update-alternatives --install \
28-
/usr/local/bin/python python /usr/bin/python3.11 1 && \
30+
/usr/local/bin/python python /usr/bin/python${PYTHON_VERSION} 1 && \
2931
python -m pip install --upgrade --no-cache-dir pip
3032

3133
COPY entrypoint.bash /usr/bin/entrypoint.bash

.github/workflows/ci.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,10 @@ jobs:
146146
uses: docker/build-push-action@v5
147147
with:
148148
context: .github/containers/nox-cross-arch
149-
file: .github/containers/nox-cross-arch/${{ matrix.arch }}-${{ matrix.os }}-python-${{ matrix.python }}.Dockerfile
149+
file: .github/containers/nox-cross-arch/${{ matrix.arch }}-${{ matrix.os }}-python.Dockerfile
150150
platforms: linux/${{ matrix.arch }}
151+
build-args: |
152+
PYTHON_VERSION=${{ matrix.python }}
151153
tags: localhost/nox-cross-arch:latest
152154
push: false
153155
load: true

0 commit comments

Comments
 (0)