Skip to content

Commit 1cafa37

Browse files
authored
Update Docker image for latest version of external libraries & tools (bytecodealliance#2374)
Devcontainer is too old to catch up the latest versions of dependencies. This PR updates the libraries & tools that WASM environment requires for Docker image. **Impediments:** - LLVM 16 can not be retrieved directly by using shell command as provided before. So we upgrade all tools manually as a workaround and just put LLVM issue URL as a comment in the script. **Improvements:** - Use `Debian 12 (Bookworm)` as a base image instead of `Ubuntu 20.04`. - `GCC9` upgraded to `GCC12`. - `LLVM14` upgraded to `LLVM16`. - `Clang10` upgraded to `Clang10`. - `Binaryen111` upgraded to `Binaryen114`. - `WASI-19` upgraded to `WASI-20` - `WABT-1.0.29` upgraded to `WABT-1.0.33` - `Bazelisk-1.12.0` upgraded to `Bazelisk-1.17.0` - `GithubCLI-2.20.2` upgraded to `GithubCLI-2.32.0` - `NodeJS-19.x` upgraded to `NodeJS-20.x` - `EMSDK-3.0.0` upgraded to `EMSDK-3.1.43` **Notes:** `Python 2.7` is removed due to no support anymore and not found in the repository.
1 parent 24c6c69 commit 1cafa37

File tree

2 files changed

+60
-41
lines changed

2 files changed

+60
-41
lines changed

.devcontainer/Dockerfile

+47-31
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,54 @@
11
# Copyright (C) 2019 Intel Corporation. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33

4-
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.195.0/containers/cpp/.devcontainer/base.Dockerfile
5-
# [Choice] Debian / Ubuntu version (use Debian 11/9, Ubuntu 18.04/21.04 on local arm64/Apple Silicon): debian-11, debian-10, debian-9, ubuntu-21.04, ubuntu-20.04, ubuntu-18.04
6-
ARG VARIANT=ubuntu-20.04
7-
FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-${VARIANT}
4+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/cpp/.devcontainer/base.Dockerfile
5+
# [Choice] Debian / Ubuntu version (use Debian 12/11/9, Ubuntu 18.04/21.04 on local arm64/Apple Silicon): debian-12, debian-11, debian-10, debian-9, ubuntu-21.04, ubuntu-20.04, ubuntu-18.04
6+
ARG VARIANT=debian-12
7+
FROM mcr.microsoft.com/vscode/devcontainers/cpp:${VARIANT}
88

99
ARG DEBIAN_FRONTEND=noninteractive
1010
ENV TZ=Asian/Shanghai
1111

1212
# hadolint ignore=DL3008
1313
RUN apt-get update \
14+
&& apt-get upgrade -y \
1415
&& apt-get install -y apt-transport-https apt-utils build-essential \
15-
ca-certificates ccache curl g++-multilib git gnupg \
16-
libgcc-9-dev lib32gcc-9-dev lsb-release \
17-
ninja-build ocaml ocamlbuild python2.7 \
16+
ca-certificates ccache cmake curl g++-multilib git gnupg \
17+
libgcc-12-dev lib32gcc-12-dev lsb-release \
18+
ninja-build ocaml ocamlbuild \
1819
software-properties-common tree tzdata \
1920
unzip valgrind vim wget zip --no-install-recommends \
2021
&& apt-get clean -y \
2122
&& rm -rf /var/lib/apt/lists/*
2223

2324
#
2425
# binaryen
25-
ARG BINARYEN_VER=111
26+
ARG BINARYEN_VER=114
2627
WORKDIR /opt
2728
RUN wget -c --progress=dot:giga https://github.com/WebAssembly/binaryen/releases/download/version_${BINARYEN_VER}/binaryen-version_${BINARYEN_VER}-x86_64-linux.tar.gz \
2829
&& tar xf binaryen-version_${BINARYEN_VER}-x86_64-linux.tar.gz \
29-
&& ln -sf /opt/binaryen-version_111 /opt/binaryen \
30+
&& ln -sf /opt/binaryen-version_${BINARYEN_VER} /opt/binaryen \
3031
&& rm binaryen-version_${BINARYEN_VER}-x86_64-linux.tar.gz
3132

3233
#
3334
# CMAKE (https://apt.kitware.com/)
3435
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
3536
# hadolint ignore=DL3008
36-
RUN wget --progress=dot:giga -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg > /dev/null \
37-
&& echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ bionic main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null \
38-
&& apt-get update \
39-
&& rm /usr/share/keyrings/kitware-archive-keyring.gpg \
40-
&& apt-get install -y kitware-archive-keyring --no-install-recommends \
41-
&& apt-get install -y cmake --no-install-recommends \
42-
&& apt-get clean -y \
43-
&& rm -rf /var/lib/apt/lists/*
37+
ARG CMAKE_VER=3.27.0
38+
RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-Linux-x86_64.sh \
39+
-q -O /tmp/cmake-install.sh \
40+
&& chmod u+x /tmp/cmake-install.sh \
41+
&& mkdir /opt/cmake-${CMAKE_VER} \
42+
&& /tmp/cmake-install.sh --skip-license --prefix=/opt/cmake-${CMAKE_VER} \
43+
&& rm /tmp/cmake-install.sh \
44+
&& ln -s /opt/cmake-${CMAKE_VER}/bin/* /usr/local/bin
4445

4546
#
4647
# install emsdk
4748
WORKDIR /opt
4849
RUN git clone https://github.com/emscripten-core/emsdk.git
4950

50-
ARG EMSDK_VER=3.0.0
51+
ARG EMSDK_VER=3.1.43
5152
WORKDIR /opt/emsdk
5253
RUN git pull \
5354
&& ./emsdk install ${EMSDK_VER} \
@@ -56,40 +57,54 @@ RUN git pull \
5657

5758
#
5859
# install wasi-sdk
59-
ARG WASI_SDK_VER=19
60+
ARG WASI_SDK_VER=20
6061
RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VER}/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz -P /opt \
6162
&& tar xf /opt/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz -C /opt \
6263
&& ln -sf /opt/wasi-sdk-${WASI_SDK_VER}.0 /opt/wasi-sdk \
6364
&& rm /opt/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz
6465

6566
#
6667
#install wabt
67-
ARG WABT_VER=1.0.29
68+
ARG WABT_VER=1.0.33
6869
RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/${WABT_VER}/wabt-${WABT_VER}-ubuntu.tar.gz -P /opt \
6970
&& tar xf /opt/wabt-${WABT_VER}-ubuntu.tar.gz -C /opt \
7071
&& ln -sf /opt/wabt-${WABT_VER} /opt/wabt \
7172
&& rm /opt/wabt-${WABT_VER}-ubuntu.tar.gz
7273

7374
#
7475
# install bazelisk
75-
ARG BAZELISK_VER=1.12.0
76+
ARG BAZELISK_VER=1.17.0
7677
RUN mkdir /opt/bazelisk \
7778
&& wget -c --progress=dot:giga https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VER}/bazelisk-linux-amd64 -P /opt/bazelisk \
7879
&& chmod a+x /opt/bazelisk/bazelisk-linux-amd64 \
7980
&& ln -fs /opt/bazelisk/bazelisk-linux-amd64 /opt/bazelisk/bazel
8081

8182
#
8283
# install clang+llvm
83-
ARG LLVM_VER=14
84-
RUN apt-get purge -y clang-10 llvm-10 && apt-get autoremove -y
84+
ARG LLVM_VER=16
85+
RUN apt-get purge -y clang-14 llvm-14 && apt-get autoremove -y
8586
WORKDIR /etc/apt/apt.conf.d
8687
RUN touch 99verfiy-peer.conf \
8788
&& echo "Acquire { https::Verify-Peer false }" > 99verfiy-peer.conf
8889

8990
WORKDIR /tmp
90-
RUN wget --progress=dot:giga https://apt.llvm.org/llvm.sh \
91-
&& chmod a+x ./llvm.sh \
92-
&& ./llvm.sh ${LLVM_VER} all
91+
#RUN wget --progress=dot:giga https://apt.llvm.org/llvm.sh \
92+
# && chmod a+x ./llvm.sh \
93+
# && ./llvm.sh ${LLVM_VER} all
94+
95+
# Workaround due to https://github.com/llvm/llvm-project/issues/62475
96+
# hadolint ignore=DL3008
97+
RUN set -ex \
98+
&& echo "deb http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-${LLVM_VER} main" > /etc/apt/sources.list.d/apt.llvm.org.list \
99+
&& wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc \
100+
&& apt-get update \
101+
&& apt-get install -y \
102+
clang-${LLVM_VER} lldb-${LLVM_VER} lld-${LLVM_VER} clangd-${LLVM_VER} clang-tidy-${LLVM_VER} clang-format-${LLVM_VER} clang-tools-${LLVM_VER} \
103+
llvm-${LLVM_VER}-dev lld-${LLVM_VER} lldb-${LLVM_VER} llvm-${LLVM_VER}-tools libomp-${LLVM_VER}-dev libc++-${LLVM_VER}-dev libc++abi-${LLVM_VER}-dev \
104+
libclang-common-${LLVM_VER}-dev libclang-${LLVM_VER}-dev libclang-cpp${LLVM_VER}-dev libunwind-${LLVM_VER}-dev \
105+
libclang-rt-${LLVM_VER}-dev libpolly-${LLVM_VER}-dev --no-install-recommends \
106+
&& apt-get clean -y \
107+
&& rm -rf /var/lib/apt/lists/*
93108

94109
#
95110
# [Optional]
@@ -105,18 +120,19 @@ RUN apt-get update \
105120
#
106121
# Install required python packages
107122
# hadolint ignore=DL3013
108-
RUN python3 -m pip install --no-cache-dir --upgrade pip \
109-
&& pip3 install --no-cache-dir black nose pycparser pylint
123+
RUN python3 -m pip install --no-cache-dir --break-system-packages --upgrade pip \
124+
&& pip3 install --no-cache-dir --break-system-packages black nose pycparser pylint
110125

111126
#
112127
# Install github-cli. It doens't work as a feature of devcontainer.json
128+
ARG GH_CLI_VER=2.32.0
113129
WORKDIR /tmp
114-
RUN wget -q https://github.com/cli/cli/releases/download/v2.20.2/gh_2.20.2_linux_amd64.deb \
115-
&& dpkg -i gh_2.20.2_linux_amd64.deb
130+
RUN wget -q https://github.com/cli/cli/releases/download/v${GH_CLI_VER}/gh_${GH_CLI_VER}_linux_amd64.deb \
131+
&& dpkg -i gh_${GH_CLI_VER}_linux_amd64.deb
116132

117133
#
118134
# Install NodeJS
119-
RUN wget -qO- https://deb.nodesource.com/setup_19.x | bash -
135+
RUN wget -qO- https://deb.nodesource.com/setup_20.x | bash -
120136
# hadolint ignore=DL3008
121137
RUN apt-get install -y nodejs --no-install-recommends
122138

.devcontainer/devcontainer.json

+13-10
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
// Copyright (C) 2019 Intel Corporation. All rights reserved.
22
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
4-
// https://github.com/microsoft/vscode-dev-containers/tree/v0.195.0/containers/cpp
4+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/cpp
55
{
66
"name": "WAMR-Dev",
77
"build": {
88
"dockerfile": "Dockerfile",
9-
// Update 'VARIANT' to pick an Debian / Ubuntu OS version: debian-11, debian-10, debian-9, ubuntu-21.04, ubuntu-20.04, ubuntu-18.04
10-
// Use Debian 11, Debian 9, Ubuntu 18.04 or Ubuntu 21.04 on local arm64/Apple Silicon
9+
// Update 'VARIANT' to pick an Debian / Ubuntu OS version: debian-12, debian-11, debian-10, debian-9, ubuntu-21.04, ubuntu-20.04, ubuntu-18.04
10+
// Use Debian 12, Debian 11, Debian 9, Ubuntu 18.04 or Ubuntu 21.04 on local arm64/Apple Silicon
1111
"args": {
12-
"BINARYEN_VER": "111",
13-
"EMSDK_VER": "3.0.0",
14-
"LLVM_VER": "15",
15-
"VARIANT": "ubuntu-20.04",
16-
"WASI_SDK_VER": "19",
17-
"WABT_VER": "1.0.31"
12+
"BINARYEN_VER": "114",
13+
"BAZELISK_VER": "1.17.0",
14+
"CMAKE_VER": "3.27.0",
15+
"EMSDK_VER": "3.1.43",
16+
"GH_CLI_VER": "2.32.0",
17+
"LLVM_VER": "16",
18+
"VARIANT": "debian-12",
19+
"WASI_SDK_VER": "20",
20+
"WABT_VER": "1.0.33"
1821
}
1922
},
2023
"runArgs": [
@@ -34,7 +37,7 @@
3437
"llvm-vs-code-extensions.vscode-clangd",
3538
"ms-python.python",
3639
"ms-python.vscode-pylance",
37-
"ms-vscode.cmake-tools",
40+
"ms-vscode.cmake-tools"
3841
]
3942
}
4043
},

0 commit comments

Comments
 (0)