Skip to content

Commit b81a21f

Browse files
committed
add initial container builds of gentoo derived python versions
Signed-off-by: Brian Harring <ferringb@gmail.com>
1 parent 7913a99 commit b81a21f

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

.github/workflows/images.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build Python Images
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * 0'
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
strategy:
15+
matrix:
16+
PYTHON_VERSION: ['3.12', '3.13', '3.14']
17+
PYTHON_UMASK: [false]
18+
include:
19+
- PYTHON_VERSION: 3.15
20+
PYTHON_UNMASK: true
21+
fail-fast: false
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v5
25+
- name: Log in to GHCR
26+
uses: docker/login-action@v3
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Build image
33+
run: |
34+
docker build \
35+
--build-arg PYTHON_VERSION=${{ matrix.PYTHON_VERSION }} \
36+
--build-arg PYTHON_UMASK=${{ matrix.PYTHON_UNMASK && '1' || '' }} \
37+
--tag ghcr.io/${{ github.repository }}/python:${{ matrix.PYTHON_VERSION }} \
38+
-f ./python-images/base.dockerfile ./python-images/
39+
- name: Push image
40+
run: |
41+
docker push ghcr.io/${{ github.repository }}/python:${{ matrix.PYTHON_VERSION }}

python-images/base.dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM docker.io/gentoo/stage3
2+
ARG PYTHON_VERSION
3+
ARG PYTHON_UNMASK
4+
# use webrsync for speed reasons, and since we don't care about "latest from today"
5+
RUN [ -n "${PYTHON_VERSION}" ] || { echo "--build-arg PYTHON_VERSION must be passed"; exit 1; }
6+
RUN \
7+
atom="<dev-lang/python-${PYTHON_VERSION}.99:${PYTHON_VERSION}" && \
8+
mkdir -p /etc/portage/package.{accept_keywords,unmask} && \
9+
echo "${atom} $([ -n "${PYTHON_UNMASK}" ] && echo '**')" >> /etc/portage/package.accept_keywords/python && \
10+
[ -z "$PYTHON_UNMASK" ] || echo "${atom}" > /etc/portage/package.unmask/python
11+
RUN \
12+
emerge-webrsync && \
13+
emerge -u dev-lang/python && \
14+
rm -rf /var/cache/distfiles /var/db/repos/gentoo

0 commit comments

Comments
 (0)