Skip to content

Support multi-arch builds in the devcontainer #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 29, 2025
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
12 changes: 10 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ on:

jobs:
build_devcontainer:
name: Build (Devcontainer)
runs-on: ubuntu-latest
name: Build and test (Devcontainer)
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm]
runs-on: ${{ matrix.os }}
env:
TAG: cpython-devcontainer:1.0.0-${{ github.run_id }}
steps:
Expand All @@ -24,6 +28,10 @@ jobs:
context: ./devcontainer
load: true
tags: ${{ env.TAG }}
- name: Test WASI SDK
run: docker run --rm ${{ env.TAG }} /opt/wasi-sdk/bin/clang --version
- name: Test Wasmtime
run: docker run --rm ${{ env.TAG }} /usr/local/bin/wasmtime --version

build_autoconf:
name: Build and test (Autoconf)
Expand Down
32 changes: 24 additions & 8 deletions devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
FROM docker.io/library/fedora:41

ENV CC=clang
ARG TARGETARCH

ENV WASI_SDK_VERSION=24
ENV WASI_SDK_PATH=/opt/wasi-sdk

ENV WASMTIME_HOME=/opt/wasmtime
ENV WASMTIME_VERSION=22.0.0
ENV WASMTIME_CPU_ARCH=x86_64
ENV CC=clang

RUN dnf -y --nodocs --setopt=install_weak_deps=False --disablerepo=fedora-cisco-openh264 install \
/usr/bin/{blurb,clang,curl,git,ln,tar,xz} \
Expand All @@ -19,12 +15,32 @@ RUN dnf -y --nodocs --setopt=install_weak_deps=False --disablerepo=fedora-cisco-
builddep python3 && \
dnf -y clean all


# Update only after consulting with WASI support maintainers (see PEP 11).
ENV WASI_SDK_VERSION=24
ENV WASI_SDK_PATH=/opt/wasi-sdk

RUN mkdir ${WASI_SDK_PATH} && \
curl --location https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_VERSION}.0-x86_64-linux.tar.gz | \
case "${TARGETARCH}" in \
amd64) WASI_ARCH="x86_64" ;; \
arm64) WASI_ARCH="arm64" ;; \
*) echo "Unsupported TARGETARCH: ${TARGETARCH}" && exit 1 ;; \
esac && \
curl --location https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_VERSION}.0-${WASI_ARCH}-linux.tar.gz | \
tar --strip-components 1 --directory ${WASI_SDK_PATH} --extract --gunzip


# Update as desired.
ENV WASMTIME_VERSION=33.0.0
ENV WASMTIME_HOME=/opt/wasmtime

RUN mkdir --parents ${WASMTIME_HOME} && \
curl --location "https://github.com/bytecodealliance/wasmtime/releases/download/v${WASMTIME_VERSION}/wasmtime-v${WASMTIME_VERSION}-${WASMTIME_CPU_ARCH}-linux.tar.xz" | \
case "${TARGETARCH}" in \
amd64) WASMTIME_ARCH="x86_64" ;; \
arm64) WASMTIME_ARCH="aarch64" ;; \
*) echo "Unsupported TARGETARCH: ${TARGETARCH}" && exit 1 ;; \
esac && \
curl --location "https://github.com/bytecodealliance/wasmtime/releases/download/v${WASMTIME_VERSION}/wasmtime-v${WASMTIME_VERSION}-${WASMTIME_ARCH}-linux.tar.xz" | \
xz --decompress | \
tar --strip-components 1 --directory ${WASMTIME_HOME} -x && \
ln -s ${WASMTIME_HOME}/wasmtime /usr/local/bin
Expand Down