Skip to content
Closed
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
27 changes: 25 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,31 @@ on:
branches: [main]

jobs:
build_devcontainer:
name: Build and test (Devcontainer)
build_build_container:
name: Build and test (build container)
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm]
runs-on: ${{ matrix.os }}
env:
TAG: cpython-buildcontainer:1.0.0-${{ github.run_id }}
steps:
- name: Checkout Push to Registry action
uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Dockerfile
uses: docker/build-push-action@v6
with:
context: ./devcontainer
load: true
tags: ${{ env.TAG }}
- name: Test Clang version
run: docker run --rm ${{ env.TAG }} clang --version

build_dev_container:
name: Build and test (Dev container)
strategy:
fail-fast: false
matrix:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
type: choice
options:
- autoconf
- buildcontainer
- devcontainer

run-name: "Release: ${{ inputs.package }}"
Expand Down
17 changes: 17 additions & 0 deletions buildcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM docker.io/library/fedora:41

LABEL org.opencontainers.image.base.name="docker.io/library/fedora:41"
LABEL org.opencontainers.image.source="https://github.com/python/cpython-devcontainers"
LABEL org.opencontainers.image.title="CPython build container"
LABEL org.opencontainers.image.description="CPython build container for Linux."
LABEL org.opencontainers.image.authors="Brett Cannon"

ENV CC=clang

# Remove a video codec repository to speed up installs.
RUN dnf config-manager setopt fedora-cisco-openh264.enabled=False

RUN mkdir -p /opt/cpython-devcontainer/bin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
RUN mkdir -p /opt/cpython-devcontainer/bin
RUN mkdir -p /opt/cpython-buildcontainer/bin

do we swap these or

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah maybe because it will be used for devcontainer? Not sure

COPY --chmod=755 install-builddeps.sh /opt/cpython-devcontainer/bin/

RUN /opt/cpython-devcontainer/bin/install-builddeps.sh
5 changes: 5 additions & 0 deletions buildcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This container image contains everything necessary to build CPython on Linux.

It is **not** meant for general development unless you are space-constrained.
For development you should use the
[dev container image](https://github.com/python/cpython-devcontainers/tree/main/devcontainer).
25 changes: 25 additions & 0 deletions buildcontainer/install-builddeps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#! /bin/bash -ex

# Install build tools and CPython dependencies on Fedora.


# Define dependencies as an array, for easier formatting & comments.
# see: https://www.gnu.org/software/bash/manual/html_node/Arrays.html
# Contents inspired by experience and
# https://github.com/devcontainers/features/tree/main/src/common-utils .
DEPS=(
# Bare minimum
/usr/bin/{blurb,clang,git}

# Necessary for getting Python build dependencies
'dnf5-command(builddep)'

# TODO: remove when Fedora version includes Python 3.14
libzstd-devel
)

dnf -y --nodocs --setopt=install_weak_deps=False install ${DEPS[@]}
dnf -y --nodocs --setopt=install_weak_deps=False builddep python3

# Don't leave caches in the container
dnf -y clean all
8 changes: 8 additions & 0 deletions devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
A general dev container for developing CPython for Linux and WASI.

See the
[devguide's container docs](https://devguide.python.org/getting-started/setup-building/#using-a-container)
on how to use this container image for development.

If you need a smaller/minimal container image, see the
[build container](https://github.com/python/cpython-devcontainers/tree/main/buildcontainer).