Skip to content

Commit e5e34ee

Browse files
committed
ci: Pass the python version as an argument, and use 3.12,3.14. Update OS: 9.3 -> 9.7
1 parent 7f76474 commit e5e34ee

3 files changed

Lines changed: 30 additions & 6 deletions

File tree

.github/actions/publish-almalinux/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ inputs:
1414
docker-labels:
1515
description: Docker image labels
1616
required: true
17+
python-version:
18+
description: Version of python to install
19+
required: true
1720

1821
runs:
1922
using: 'composite'

.github/workflows/publish-almalinux.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ jobs:
1919
name: Publish AlmaLinux
2020
runs-on: ubuntu-latest
2121

22+
# Prepare the ground to have multiple python versions. Note that this should be passed to the
23+
# underlying image
24+
strategy:
25+
matrix:
26+
python: ["3.11", "3.12"]
27+
2228
steps:
2329
- name: Checkout
2430
uses: actions/checkout@v4
@@ -34,7 +40,7 @@ jobs:
3440
id: meta
3541
uses: docker/metadata-action@v4
3642
with:
37-
images: registry.cern.ch/${{ github.repository_owner }}/almalinux
43+
images: registry.cern.ch/${{ github.repository_owner }}/almalinux-${{ matrix.python }}
3844
tags: |
3945
type=semver,pattern={{major}}
4046
type=semver,pattern={{major}}.{{minor}}
@@ -47,6 +53,7 @@ jobs:
4753
- name: Publish AlmaLinux
4854
uses: ./.github/actions/publish-almalinux
4955
with:
56+
python-version: ${{ matrix.python }}
5057
registry-username: ${{ secrets.CERN_REGISTRY_USERNAME }}
5158
registry-password: ${{ secrets.CERN_REGISTRY_PASSWORD }}
5259
docker-tags: ${{ steps.meta.outputs.tags }}

almalinux/Dockerfile

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,24 @@
77
# Invenio is free software; you can redistribute it and/or modify it
88
# under the terms of the MIT License; see LICENSE file for more details.
99
#
10-
ARG LINUX_VERSION=9.3
10+
ARG PYTHON_VERSION=3.12
11+
ARG LINUX_VERSION=9
12+
ARG NODEJS_VERSION=22
1113
ARG BUILDPLATFORM=linux/amd64
1214
FROM --platform=$BUILDPLATFORM almalinux:${LINUX_VERSION}
1315

16+
ARG PYTHON_VERSION
17+
RUN dnf install -y python${PYTHON_VERSION} python${PYTHON_VERSION}-devel python${PYTHON_VERSION}-pip\
18+
&& dnf clean all
19+
20+
ARG PYTHON_VERSION
21+
RUN python${PYTHON_VERSION} -m pip install --upgrade pip setuptools wheel
22+
23+
# Symlink Python
24+
ARG PYTHON_VERSION
25+
RUN ln -sfn /usr/bin/python${PYTHON_VERSION} /usr/local/bin/python3 && \
26+
ln -sfn /usr/bin/pip${PYTHON_VERSION} /usr/local/bin/pip3
27+
1428
RUN dnf upgrade --refresh -y && \
1529
dnf install -y \
1630
dnf-plugins-core \
@@ -28,9 +42,10 @@ ENV LC_ALL=en_US.UTF-8
2842

2943
# EPEL: Extra Packages for Enterprise Linux 9
3044
# `epel-release` is not recent/complete enough, as some packages below are missing
45+
ARG LINUX_VERSION
3146
RUN dnf config-manager --set-enabled crb && \
3247
dnf install -y \
33-
https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
48+
https://dl.fedoraproject.org/pub/epel/epel-release-latest-${LINUX_VERSION}.noarch.rpm
3449

3550
# Install needed and useful tools:
3651
# - python and friends
@@ -60,14 +75,13 @@ RUN dnf install -y \
6075
iotop iftop \
6176
tcpdump bind-utils
6277

63-
# Symlink Python
64-
RUN ln -sfn /usr/bin/python3 /usr/bin/python
6578
# `python3-packaging` is installed by `yum` and it causes issues with `pip` installations
6679
RUN yum remove python3-packaging -y
6780
RUN pip3 install --upgrade pip pipenv wheel
6881

6982
# Install Node.js
70-
RUN curl -fsSL https://rpm.nodesource.com/setup_22.x | bash - && \
83+
ARG NODEJS_VERSION
84+
RUN curl -fsSL https://rpm.nodesource.com/setup_${NODEJS_VERSION}.x | bash - && \
7185
dnf -y install nodejs
7286

7387
# Reduce image size: clean up caches, remove RPM db files

0 commit comments

Comments
 (0)