Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Move devcontainer installation to shell scripts #46

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 2 commits into from
Jun 12, 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
37 changes: 6 additions & 31 deletions devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,22 @@ FROM docker.io/library/fedora:41

ARG TARGETARCH


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} \
compiler-rt \
# TODO: remove when Fedora version includes Python 3.14+
libzstd-devel \
'dnf5-command(builddep)' && \
dnf -y --nodocs --setopt=install_weak_deps=False --disablerepo=fedora-cisco-openh264 \
builddep python3 && \
dnf -y clean all

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

# 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} && \
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} && \
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

RUN mkdir -p /opt/cpython-devcontainer/bin
COPY --chmod=755 install-builddeps.sh install-wasi.sh /opt/cpython-devcontainer/bin/

RUN /opt/cpython-devcontainer/bin/install-builddeps.sh
RUN /opt/cpython-devcontainer/bin/install-wasi.sh
23 changes: 23 additions & 0 deletions devcontainer/install-builddeps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#! /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
DEPS=(
/usr/bin/{blurb,clang,curl,git,ln,tar,xz}
'dnf5-command(builddep)'

# LLVM sanitizer runtimes
compiler-rt

# 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
34 changes: 34 additions & 0 deletions devcontainer/install-wasi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#! /bin/bash -ex

# Install the WASI SDK.
# This should be portable to any Linux, but is only tested in the devcontainer.


mkdir ${WASI_SDK_PATH}

case "${TARGETARCH}" in
amd64) WASI_ARCH="x86_64" ;;
arm64) WASI_ARCH="arm64" ;;
*) echo "Unsupported TARGETARCH: ${TARGETARCH}" && exit 1 ;;
esac && \

URL=https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_VERSION}.0-${WASI_ARCH}-linux.tar.gz

curl --location $URL | tar --strip-components 1 --directory ${WASI_SDK_PATH} --extract --gunzip


mkdir --parents ${WASMTIME_HOME}

case "${TARGETARCH}" in
amd64) WASMTIME_ARCH="x86_64" ;;
arm64) WASMTIME_ARCH="aarch64" ;;
*) echo "Unsupported TARGETARCH: ${TARGETARCH}" && exit 1 ;;
esac

URL="https://github.com/bytecodealliance/wasmtime/releases/download/v${WASMTIME_VERSION}/wasmtime-v${WASMTIME_VERSION}-${WASMTIME_ARCH}-linux.tar.xz"

curl --location $URL |
xz --decompress |
tar --strip-components 1 --directory ${WASMTIME_HOME} -x

ln -s ${WASMTIME_HOME}/wasmtime /usr/local/bin