Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
- name: Set Calver Date
run: |
echo "builddate=$(date +'%Y.%m.%d')" >> $GITHUB_OUTPUT
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
id: version
- name: Checkout
uses: actions/checkout@v5
Expand All @@ -34,6 +35,69 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract labels from the Dockerfile to use as OCI annotations.
# This allows them to show up on the webpages for the containers on GHCR due to using
# multi-arch images
# (as documented at
# https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#adding-a-description-to-multi-arch-images
# ).
# The pre-defined annotations by the OCI that you can add to a manifest can be found at
# https://specs.opencontainers.org/image-spec/annotations/#pre-defined-annotation-keys
- name: Extract labels from Dockerfile
id: labels
run: |
set -euo pipefail

# Extract labels from the Dockerfile.
DOCKERFILE=./${{ inputs.container }}/Dockerfile

# Function to extract a label value.
extract_label() {
local label_key="$1"
grep "org.opencontainers.image.${label_key}=" "$DOCKERFILE" | \
sed -n 's/.*org\.opencontainers\.image\.'"${label_key}"'="\([^"]*\)".*/\1/p' | \
head -n1 || echo ''
}

# Function to add annotation if value is non-empty.
add_annotation() {
local key="$1"
local value="$2"
if [ -n "$value" ]; then
[ -n "$annotations" ] && annotations="$annotations,"
annotations="${annotations}annotation-index.org.opencontainers.image.${key}=${value}"
fi
}

# Extract static labels from Dockerfile.
source=$(extract_label "source")
description=$(extract_label "description")
title=$(extract_label "title")
authors=$(extract_label "authors")
base_name=$(extract_label "base.name")
licenses=$(extract_label "licenses")
url=$(extract_label "url")
documentation=$(extract_label "documentation")

# Get dynamic values from earlier steps.
created="${{ steps.version.outputs.created }}"
revision="${{ github.sha }}"

# Build annotations string.
annotations=""
add_annotation "source" "$source"
add_annotation "description" "$description"
add_annotation "title" "$title"
add_annotation "authors" "$authors"
add_annotation "base.name" "$base_name"
add_annotation "licenses" "$licenses"
add_annotation "url" "$url"
add_annotation "documentation" "$documentation"
add_annotation "created" "$created"
add_annotation "revision" "$revision"

# Output the complete annotations string.
echo "annotations=$annotations" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v6
with:
Expand All @@ -43,3 +107,4 @@ jobs:
tags: |
ghcr.io/python/${{ inputs.container }}:${{ steps.version.outputs.builddate }}.${{ github.run_id }}
ghcr.io/python/${{ inputs.container }}:latest
outputs: type=image,name=ghcr.io/python/${{ inputs.container }},${{ steps.labels.outputs.annotations }}
5 changes: 4 additions & 1 deletion autoconf/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ ARG AUTOMAKE_VERSION="1.16.5"
ARG CONFIG_GIT_REV="00b15927496058d23e6258a28d8996f87cf1f191"

LABEL org.opencontainers.image.source="https://github.com/python/cpython-devcontainers"
LABEL org.opencontainers.image.base.name="docker.io/library/ubuntu:22.04"
LABEL org.opencontainers.image.base.name="docker.io/library/ubuntu:24.04"
LABEL org.opencontainers.image.authors="Donghee Na"
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."
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.url="https://github.com/python/cpython-devcontainers"
LABEL org.opencontainers.image.documentation="https://github.com/python/cpython-devcontainers/blob/main/autoconf/README.md"

RUN apt-get update && \
apt-get install -yq \
Expand Down
1 change: 1 addition & 0 deletions autoconf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Container image for recreating `configure` from `configure.ac` for CPython (via the `make regen-configure` command).
3 changes: 3 additions & 0 deletions devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ LABEL org.opencontainers.image.source="https://github.com/python/cpython-devcont
LABEL org.opencontainers.image.title="CPython development container"
LABEL org.opencontainers.image.description="CPython development container with the tooling to work on Linux builds."
LABEL org.opencontainers.image.authors="Brett Cannon"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.url="https://github.com/python/cpython-devcontainers"
LABEL org.opencontainers.image.documentation="https://github.com/python/cpython-devcontainers/blob/main/devcontainer/README.md"

ENV CC=clang

Expand Down
5 changes: 4 additions & 1 deletion wasicontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
FROM ghcr.io/python/devcontainer:latest

LABEL org.opencontainers.image.base.name="ghcr.io/python/wasicontainer:latest"
LABEL org.opencontainers.image.base.name="ghcr.io/python/devcontainer:latest"
LABEL org.opencontainers.image.source="https://github.com/python/cpython-devcontainers"
LABEL org.opencontainers.image.title="CPython WASI development container"
LABEL org.opencontainers.image.description="CPython development container with the tooling to work on WASI builds."
LABEL org.opencontainers.image.authors="Brett Cannon"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.url="https://github.com/python/cpython-devcontainers"
LABEL org.opencontainers.image.documentation="https://github.com/python/cpython-devcontainers/blob/main/wasicontainer/README.md"

ARG TARGETARCH

Expand Down