Skip to content

Commit

Permalink
Updates (#12)
Browse files Browse the repository at this point in the history
* CI: Add build matrix

* Entryscript: use explicit paths for invocation

* Dockerfile: add build args for versions, and install automake and autoconf-archive

* Entryscript: don't check sentinel if we're running arbitrary commands

* Adjust CI name

* Remove QEMU from build/test CI
  • Loading branch information
erlend-aasland committed Mar 4, 2024
1 parent acfa79b commit e88aa45
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 28 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/ci.yml
Expand Up @@ -9,20 +9,25 @@ on:

jobs:
build:
name: Build Dockerfile for amd64 and arm64
name: Build and test
strategy:
fail-fast: false
matrix:
autoconf_version: ["2.69", "2.71", "2.72"]
runs-on: ubuntu-latest
env:
TAG: autoconf:${{ matrix.autoconf_version }}-${{ github.run_id }}
steps:
- name: Checkout Push to Registry action
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Dockerfile
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: false
tags: |
ghcr.io/corona10/cpython_autoconf
build-args: AUTOCONF_VERSION=${{ matrix.autoconf_version }}
load: true
tags: ${{ env.TAG }}
- name: Test
run: docker run --rm $TAG autoconf --version | grep ${{ matrix.autoconf_version }}
32 changes: 25 additions & 7 deletions Dockerfile
@@ -1,21 +1,39 @@
FROM docker.io/library/alpine:3.19

ARG AUTOCONF_VERSION="2.71"
ARG AUTOCONF_ARCHIVE_VERSION="2023.02.20"
ARG AUTOMAKE_VERSION="1.16.5"

LABEL org.opencontainers.image.source="https://github.com/corona10/cpython_autoconf"
LABEL org.opencontainers.image.base.name="docker.io/library/alpine:3.19"
LABEL org.opencontainers.image.authors="Donghee Na"
LABEL org.opencontainers.image.title="autoconf 2.72 container for CPython"
LABEL org.opencontainers.image.description="Container image with autoconf 2.72 tools to regenerate Python's configure script."
LABEL org.opencontainers.image.title="GNU Autoconf ${AUTOCONF_VERSION} container for CPython"
LABEL org.opencontainers.image.description="Container image with GNU Autoconf ${AUTOCONF_VERSION}, GNU Automake ${AUTOMAKE_VERSION}, and autoconf-archive ${AUTOCONF_ARCHIVE_VERSION} for generating CPython's configure script."

RUN apk upgrade && \
apk add \
alpine-sdk \
autoconf \
automake \
autoconf-archive \
libtool \
pkgconfig
RUN curl https://ftp.gnu.org/gnu/autoconf/autoconf-2.72.tar.gz | tar -zxvf -
RUN cd autoconf-2.72 && ./configure && make && make install
xz
RUN set -o pipefail \
&& curl https://ftp.gnu.org/gnu/autoconf/autoconf-${AUTOCONF_VERSION}.tar.gz | tar -zxf - \
&& cd autoconf-${AUTOCONF_VERSION} \
&& ./configure --prefix=/usr/local \
&& make \
&& make install
RUN set -o pipefail \
&& curl https://ftp.gnu.org/gnu/automake/automake-${AUTOMAKE_VERSION}.tar.gz | tar -xzf - \
&& cd automake-${AUTOMAKE_VERSION} \
&& ./configure --prefix=/usr/local \
&& make \
&& make install
RUN set -o pipefail \
&& curl https://ftp.gnu.org/gnu/autoconf-archive/autoconf-archive-${AUTOCONF_ARCHIVE_VERSION}.tar.xz | xz -cd - | tar -xf - \
&& cd autoconf-archive-${AUTOCONF_ARCHIVE_VERSION} \
&& ./configure --prefix=/usr/local \
&& make \
&& make install

VOLUME /src
WORKDIR /src
Expand Down
31 changes: 17 additions & 14 deletions entry.sh
@@ -1,21 +1,24 @@
#!/bin/sh
set -e

SRC=/src
SENTINEL=${SRC}/pyconfig.h.in

if [ ! -e ${SENTINEL} ]; then
echo "ERROR: ${SENTINEL} not found "
echo "Did you forget to mount Python work directory with '-v.:/src'?"
echo
echo " docker run -v.:/src dongheena/cpython_autoconf"
echo " podman run -v.:/src:Z dongheena/cpython_autoconf"
exit 2
fi
BIN=/usr/local/bin
AUTOCONF=$BIN/autoconf
AUTORECONF=$BIN/autoreconf

if [ "$#" = "0" ]; then
echo "Rebuilding configure script using $(autoconf --version | head -n 1)"
exec gosu autoreconf -ivf -Werror $@
local SENTINEL=/src/pyconfig.h.in

if [ ! -e ${SENTINEL} ]; then
echo "ERROR: ${SENTINEL} not found "
echo "Did you forget to mount Python work directory with '-v.:/src'?"
echo
echo " docker run -v\$PWD:/src ghcr.io/corona10/cpython_autoconf"
echo " podman run -v\$PWD:/src:Z ghcr.io/corona10/cpython_autoconf"
exit 2
fi

echo "Rebuilding configure script using $($AUTOCONF --version | head -n 1)"
exec gosu $AUTORECONF -ivf -Werror $@
fi

exec "$@"
exec "$@"

0 comments on commit e88aa45

Please sign in to comment.