Skip to content

Commit e14bd48

Browse files
committed
Support multi-arch builds in the devcontainer
Make WASI SDK and Wasmtime work under x86-64 and arm64.
1 parent 817a84b commit e14bd48

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
jobs:
1111
build_devcontainer:
12-
name: Build (Devcontainer)
12+
name: Build and test (Devcontainer)
1313
runs-on: ubuntu-latest
1414
env:
1515
TAG: cpython-devcontainer:1.0.0-${{ github.run_id }}
@@ -24,6 +24,10 @@ jobs:
2424
context: ./devcontainer
2525
load: true
2626
tags: ${{ env.TAG }}
27+
- name: Test WASI SDK
28+
run: docker run --rm ${{ env.TAG }} /opt/wasi-sdk/bin/clang --version
29+
- name: Test Wasmtime
30+
run: docker run --rm ${{ env.TAG }} /usr/local/bin/wasmtime --version
2731

2832
build_autoconf:
2933
name: Build and test (Autoconf)

devcontainer/Dockerfile

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
FROM docker.io/library/fedora:41
22

3-
ENV CC=clang
3+
ARG TARGETARCH
44

5-
ENV WASI_SDK_VERSION=24
6-
ENV WASI_SDK_PATH=/opt/wasi-sdk
75

8-
ENV WASMTIME_HOME=/opt/wasmtime
9-
ENV WASMTIME_VERSION=22.0.0
10-
ENV WASMTIME_CPU_ARCH=x86_64
6+
ENV CC=clang
117

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

18+
19+
ENV WASI_SDK_VERSION=24
20+
ENV WASI_SDK_PATH=/opt/wasi-sdk
21+
2222
RUN mkdir ${WASI_SDK_PATH} && \
23-
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 | \
23+
case "${TARGETARCH}" in \
24+
amd64) WASI_ARCH="x86_64" ;; \
25+
arm64) WASI_ARCH="arm64" ;; \
26+
*) echo "Unsupported TARGETARCH: ${TARGETARCH}" && exit 1 ;; \
27+
esac && \
28+
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 | \
2429
tar --strip-components 1 --directory ${WASI_SDK_PATH} --extract --gunzip
2530

31+
32+
ENV WASMTIME_HOME=/opt/wasmtime
33+
ENV WASMTIME_VERSION=33.0.0
34+
2635
RUN mkdir --parents ${WASMTIME_HOME} && \
27-
curl --location "https://github.com/bytecodealliance/wasmtime/releases/download/v${WASMTIME_VERSION}/wasmtime-v${WASMTIME_VERSION}-${WASMTIME_CPU_ARCH}-linux.tar.xz" | \
36+
case "${TARGETARCH}" in \
37+
amd64) WASMTIME_ARCH="x86_64" ;; \
38+
arm64) WASMTIME_ARCH="aarch64" ;; \
39+
*) echo "Unsupported TARGETARCH: ${TARGETARCH}" && exit 1 ;; \
40+
esac && \
41+
curl --location "https://github.com/bytecodealliance/wasmtime/releases/download/v${WASMTIME_VERSION}/wasmtime-v${WASMTIME_VERSION}-${WASMTIME_ARCH}-linux.tar.xz" | \
2842
xz --decompress | \
2943
tar --strip-components 1 --directory ${WASMTIME_HOME} -x && \
3044
ln -s ${WASMTIME_HOME}/wasmtime /usr/local/bin

0 commit comments

Comments
 (0)