Update Docker image for latest version of external libraries & tools (#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.
This commit is contained in:
Cengizhan Pasaoglu 2023-07-24 12:43:13 +03:00 committed by GitHub
parent 24c6c6977b
commit 1cafa37568
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 60 additions and 41 deletions

View File

@ -1,20 +1,21 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved. # Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.195.0/containers/cpp/.devcontainer/base.Dockerfile # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/cpp/.devcontainer/base.Dockerfile
# [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 # [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
ARG VARIANT=ubuntu-20.04 ARG VARIANT=debian-12
FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-${VARIANT} FROM mcr.microsoft.com/vscode/devcontainers/cpp:${VARIANT}
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Asian/Shanghai ENV TZ=Asian/Shanghai
# hadolint ignore=DL3008 # hadolint ignore=DL3008
RUN apt-get update \ RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y apt-transport-https apt-utils build-essential \ && apt-get install -y apt-transport-https apt-utils build-essential \
ca-certificates ccache curl g++-multilib git gnupg \ ca-certificates ccache cmake curl g++-multilib git gnupg \
libgcc-9-dev lib32gcc-9-dev lsb-release \ libgcc-12-dev lib32gcc-12-dev lsb-release \
ninja-build ocaml ocamlbuild python2.7 \ ninja-build ocaml ocamlbuild \
software-properties-common tree tzdata \ software-properties-common tree tzdata \
unzip valgrind vim wget zip --no-install-recommends \ unzip valgrind vim wget zip --no-install-recommends \
&& apt-get clean -y \ && apt-get clean -y \
@ -22,32 +23,32 @@ RUN apt-get update \
# #
# binaryen # binaryen
ARG BINARYEN_VER=111 ARG BINARYEN_VER=114
WORKDIR /opt WORKDIR /opt
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 \ 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 \
&& tar xf binaryen-version_${BINARYEN_VER}-x86_64-linux.tar.gz \ && tar xf binaryen-version_${BINARYEN_VER}-x86_64-linux.tar.gz \
&& ln -sf /opt/binaryen-version_111 /opt/binaryen \ && ln -sf /opt/binaryen-version_${BINARYEN_VER} /opt/binaryen \
&& rm binaryen-version_${BINARYEN_VER}-x86_64-linux.tar.gz && rm binaryen-version_${BINARYEN_VER}-x86_64-linux.tar.gz
# #
# CMAKE (https://apt.kitware.com/) # CMAKE (https://apt.kitware.com/)
SHELL ["/bin/bash", "-o", "pipefail", "-c"] SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# hadolint ignore=DL3008 # hadolint ignore=DL3008
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 \ ARG CMAKE_VER=3.27.0
&& 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 \ RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-Linux-x86_64.sh \
&& apt-get update \ -q -O /tmp/cmake-install.sh \
&& rm /usr/share/keyrings/kitware-archive-keyring.gpg \ && chmod u+x /tmp/cmake-install.sh \
&& apt-get install -y kitware-archive-keyring --no-install-recommends \ && mkdir /opt/cmake-${CMAKE_VER} \
&& apt-get install -y cmake --no-install-recommends \ && /tmp/cmake-install.sh --skip-license --prefix=/opt/cmake-${CMAKE_VER} \
&& apt-get clean -y \ && rm /tmp/cmake-install.sh \
&& rm -rf /var/lib/apt/lists/* && ln -s /opt/cmake-${CMAKE_VER}/bin/* /usr/local/bin
# #
# install emsdk # install emsdk
WORKDIR /opt WORKDIR /opt
RUN git clone https://github.com/emscripten-core/emsdk.git RUN git clone https://github.com/emscripten-core/emsdk.git
ARG EMSDK_VER=3.0.0 ARG EMSDK_VER=3.1.43
WORKDIR /opt/emsdk WORKDIR /opt/emsdk
RUN git pull \ RUN git pull \
&& ./emsdk install ${EMSDK_VER} \ && ./emsdk install ${EMSDK_VER} \
@ -56,7 +57,7 @@ RUN git pull \
# #
# install wasi-sdk # install wasi-sdk
ARG WASI_SDK_VER=19 ARG WASI_SDK_VER=20
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 \ 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 \
&& tar xf /opt/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz -C /opt \ && tar xf /opt/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz -C /opt \
&& ln -sf /opt/wasi-sdk-${WASI_SDK_VER}.0 /opt/wasi-sdk \ && ln -sf /opt/wasi-sdk-${WASI_SDK_VER}.0 /opt/wasi-sdk \
@ -64,7 +65,7 @@ RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases
# #
#install wabt #install wabt
ARG WABT_VER=1.0.29 ARG WABT_VER=1.0.33
RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/${WABT_VER}/wabt-${WABT_VER}-ubuntu.tar.gz -P /opt \ RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/${WABT_VER}/wabt-${WABT_VER}-ubuntu.tar.gz -P /opt \
&& tar xf /opt/wabt-${WABT_VER}-ubuntu.tar.gz -C /opt \ && tar xf /opt/wabt-${WABT_VER}-ubuntu.tar.gz -C /opt \
&& ln -sf /opt/wabt-${WABT_VER} /opt/wabt \ && ln -sf /opt/wabt-${WABT_VER} /opt/wabt \
@ -72,7 +73,7 @@ RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wabt/releases/dow
# #
# install bazelisk # install bazelisk
ARG BAZELISK_VER=1.12.0 ARG BAZELISK_VER=1.17.0
RUN mkdir /opt/bazelisk \ RUN mkdir /opt/bazelisk \
&& wget -c --progress=dot:giga https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VER}/bazelisk-linux-amd64 -P /opt/bazelisk \ && wget -c --progress=dot:giga https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VER}/bazelisk-linux-amd64 -P /opt/bazelisk \
&& chmod a+x /opt/bazelisk/bazelisk-linux-amd64 \ && chmod a+x /opt/bazelisk/bazelisk-linux-amd64 \
@ -80,16 +81,30 @@ RUN mkdir /opt/bazelisk \
# #
# install clang+llvm # install clang+llvm
ARG LLVM_VER=14 ARG LLVM_VER=16
RUN apt-get purge -y clang-10 llvm-10 && apt-get autoremove -y RUN apt-get purge -y clang-14 llvm-14 && apt-get autoremove -y
WORKDIR /etc/apt/apt.conf.d WORKDIR /etc/apt/apt.conf.d
RUN touch 99verfiy-peer.conf \ RUN touch 99verfiy-peer.conf \
&& echo "Acquire { https::Verify-Peer false }" > 99verfiy-peer.conf && echo "Acquire { https::Verify-Peer false }" > 99verfiy-peer.conf
WORKDIR /tmp WORKDIR /tmp
RUN wget --progress=dot:giga https://apt.llvm.org/llvm.sh \ #RUN wget --progress=dot:giga https://apt.llvm.org/llvm.sh \
&& chmod a+x ./llvm.sh \ # && chmod a+x ./llvm.sh \
&& ./llvm.sh ${LLVM_VER} all # && ./llvm.sh ${LLVM_VER} all
# Workaround due to https://github.com/llvm/llvm-project/issues/62475
# hadolint ignore=DL3008
RUN set -ex \
&& echo "deb http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-${LLVM_VER} main" > /etc/apt/sources.list.d/apt.llvm.org.list \
&& wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc \
&& apt-get update \
&& apt-get install -y \
clang-${LLVM_VER} lldb-${LLVM_VER} lld-${LLVM_VER} clangd-${LLVM_VER} clang-tidy-${LLVM_VER} clang-format-${LLVM_VER} clang-tools-${LLVM_VER} \
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 \
libclang-common-${LLVM_VER}-dev libclang-${LLVM_VER}-dev libclang-cpp${LLVM_VER}-dev libunwind-${LLVM_VER}-dev \
libclang-rt-${LLVM_VER}-dev libpolly-${LLVM_VER}-dev --no-install-recommends \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
# #
# [Optional] # [Optional]
@ -105,18 +120,19 @@ RUN apt-get update \
# #
# Install required python packages # Install required python packages
# hadolint ignore=DL3013 # hadolint ignore=DL3013
RUN python3 -m pip install --no-cache-dir --upgrade pip \ RUN python3 -m pip install --no-cache-dir --break-system-packages --upgrade pip \
&& pip3 install --no-cache-dir black nose pycparser pylint && pip3 install --no-cache-dir --break-system-packages black nose pycparser pylint
# #
# Install github-cli. It doens't work as a feature of devcontainer.json # Install github-cli. It doens't work as a feature of devcontainer.json
ARG GH_CLI_VER=2.32.0
WORKDIR /tmp WORKDIR /tmp
RUN wget -q https://github.com/cli/cli/releases/download/v2.20.2/gh_2.20.2_linux_amd64.deb \ RUN wget -q https://github.com/cli/cli/releases/download/v${GH_CLI_VER}/gh_${GH_CLI_VER}_linux_amd64.deb \
&& dpkg -i gh_2.20.2_linux_amd64.deb && dpkg -i gh_${GH_CLI_VER}_linux_amd64.deb
# #
# Install NodeJS # Install NodeJS
RUN wget -qO- https://deb.nodesource.com/setup_19.x | bash - RUN wget -qO- https://deb.nodesource.com/setup_20.x | bash -
# hadolint ignore=DL3008 # hadolint ignore=DL3008
RUN apt-get install -y nodejs --no-install-recommends RUN apt-get install -y nodejs --no-install-recommends

View File

@ -1,20 +1,23 @@
// Copyright (C) 2019 Intel Corporation. All rights reserved. // Copyright (C) 2019 Intel Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: // For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.195.0/containers/cpp // https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/cpp
{ {
"name": "WAMR-Dev", "name": "WAMR-Dev",
"build": { "build": {
"dockerfile": "Dockerfile", "dockerfile": "Dockerfile",
// Update 'VARIANT' to pick an Debian / Ubuntu OS version: debian-11, debian-10, debian-9, ubuntu-21.04, ubuntu-20.04, ubuntu-18.04 // 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
// Use Debian 11, Debian 9, Ubuntu 18.04 or Ubuntu 21.04 on local arm64/Apple Silicon // Use Debian 12, Debian 11, Debian 9, Ubuntu 18.04 or Ubuntu 21.04 on local arm64/Apple Silicon
"args": { "args": {
"BINARYEN_VER": "111", "BINARYEN_VER": "114",
"EMSDK_VER": "3.0.0", "BAZELISK_VER": "1.17.0",
"LLVM_VER": "15", "CMAKE_VER": "3.27.0",
"VARIANT": "ubuntu-20.04", "EMSDK_VER": "3.1.43",
"WASI_SDK_VER": "19", "GH_CLI_VER": "2.32.0",
"WABT_VER": "1.0.31" "LLVM_VER": "16",
"VARIANT": "debian-12",
"WASI_SDK_VER": "20",
"WABT_VER": "1.0.33"
} }
}, },
"runArgs": [ "runArgs": [
@ -34,7 +37,7 @@
"llvm-vs-code-extensions.vscode-clangd", "llvm-vs-code-extensions.vscode-clangd",
"ms-python.python", "ms-python.python",
"ms-python.vscode-pylance", "ms-python.vscode-pylance",
"ms-vscode.cmake-tools", "ms-vscode.cmake-tools"
] ]
} }
}, },