From c98033b1dc679a5e3ded53ee52ad15e738eeb0a0 Mon Sep 17 00:00:00 2001 From: John Helmert III Date: Wed, 28 Jun 2023 19:22:56 -0700 Subject: add plumbing to produce a python testing image Closes: #73 Signed-off-by: John Helmert III Closes: https://github.com/gentoo/gentoo-docker-images/pull/128 --- .github/workflows/build.yml | 5 +++++ build-python.sh | 17 +++++++++++++++++ python.Dockerfile | 16 ++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100755 build-python.sh create mode 100644 python.Dockerfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 021efcc..ef4e56f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,6 +15,7 @@ jobs: fail-fast: false matrix: target: + - python - portage - stage3-amd64-hardened-nomultilib-openrc - stage3-amd64-hardened-openrc @@ -67,7 +68,11 @@ jobs: - name: Set up buildx uses: docker/setup-buildx-action@v2 - name: Build image + if: startswith(matrix.target, 'stage3') || startswith(matrix.target, 'portage') run: ./build.sh + - name: Build python image + if: startswith( matrix.target, 'python') + run: ./build-python.sh - name: Inspect image run: docker image inspect "${ORG}/${TARGET/-/:}" - name: Inspect portage diff --git a/build-python.sh b/build-python.sh new file mode 100755 index 0000000..6289c05 --- /dev/null +++ b/build-python.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +NAME=python +VERSION=${VERSION:-$(date -u +%Y%m%d)} +VERSION_SUFFIX="-${VERSION}" + +ORG=${ORG:-gentoo} + +docker buildx build \ + --file "${NAME}.Dockerfile" \ + --build-arg ARCH="amd64" \ + --build-arg MICROARCH="amd64" \ + --tag "${ORG}/python" \ + --platform "linux/amd64" \ + --progress plain \ + --load \ + . diff --git a/python.Dockerfile b/python.Dockerfile new file mode 100644 index 0000000..7b61532 --- /dev/null +++ b/python.Dockerfile @@ -0,0 +1,16 @@ +FROM gentoo/stage3:amd64-nomultilib-openrc + +# derived from https://github.com/projg2/gentoo-python-image/blob/master/Dockerfile + +RUN echo '*/* ~amd64' >> /etc/portage/package.accept_keywords/base.conf \ + && echo '*/* full-stdlib sqlite' >> /etc/portage/package.use/python \ + && echo 'dev-vcs/git -perl' >> /etc/portage/package.use/git \ + && wget --progress=dot:mega -O - https://github.com/gentoo-mirror/gentoo/archive/master.tar.gz | tar -xz \ + && mv gentoo-master /var/db/repos/gentoo \ + && emerge -1vnt --jobs dev-python/tox app-arch/lzip dev-vcs/git \ + dev-python/pypy{,3_9,3_10}-exe-bin dev-db/sqlite \ + && emerge -1v --jobs --nodeps dev-lang/python:{2.7,3.8,3.9,3.10,3.11,3.12} \ + dev-python/pypy{,3_9,3_10,3} \ + && rm -r /var/db/repos/* /var/cache/distfiles/* + +CMD ["/bin/bash"] -- cgit v1.2.3-65-gdbad