Dockerfile 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.195.0/containers/cpp/.devcontainer/base.Dockerfile
  4. # [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
  5. ARG VARIANT=ubuntu-20.04
  6. FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-${VARIANT}
  7. ARG DEBIAN_FRONTEND=noninteractive
  8. ENV TZ=Asian/Shanghai
  9. RUN apt update \
  10. && apt install -y apt-transport-https apt-utils build-essential \
  11. ca-certificates curl g++-multilib git gnupg \
  12. libgcc-9-dev lib32gcc-9-dev lsb-release \
  13. ninja-build ocaml ocamlbuild python2.7 \
  14. software-properties-common tree tzdata \
  15. unzip valgrind vim wget zip
  16. #
  17. # CMAKE (https://apt.kitware.com/)
  18. RUN wget -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 \
  19. && 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 \
  20. && apt update \
  21. && rm /usr/share/keyrings/kitware-archive-keyring.gpg \
  22. && apt install -y kitware-archive-keyring \
  23. && apt install -y cmake
  24. #
  25. # install emsdk
  26. RUN cd /opt \
  27. && git clone https://github.com/emscripten-core/emsdk.git
  28. RUN cd /opt/emsdk \
  29. && git pull \
  30. && ./emsdk install 2.0.26 \
  31. && ./emsdk activate 2.0.26 \
  32. && echo "source /opt/emsdk/emsdk_env.sh" >> /root/.bashrc
  33. #
  34. # install wasi-sdk
  35. ARG WASI_SDK_VER=16
  36. RUN wget -c https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VER}/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz -P /opt
  37. RUN tar xf /opt/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz -C /opt \
  38. && ln -fs /opt/wasi-sdk-${WASI_SDK_VER}.0 /opt/wasi-sdk
  39. RUN rm /opt/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz
  40. #
  41. #install wabt
  42. ARG WABT_VER=1.0.29
  43. RUN wget -c https://github.com/WebAssembly/wabt/releases/download/${WABT_VER}/wabt-${WABT_VER}-ubuntu.tar.gz -P /opt
  44. RUN tar xf /opt/wabt-${WABT_VER}-ubuntu.tar.gz -C /opt \
  45. && ln -fs /opt/wabt-${WABT_VER} /opt/wabt
  46. RUN rm /opt/wabt-${WABT_VER}-ubuntu.tar.gz
  47. #
  48. # install bazelisk
  49. ARG BAZELISK_VER=1.12.0
  50. RUN mkdir /opt/bazelisk
  51. RUN wget -c https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VER}/bazelisk-linux-amd64 -P /opt/bazelisk
  52. RUN chmod a+x /opt/bazelisk/bazelisk-linux-amd64 \
  53. && ln -fs /opt/bazelisk/bazelisk-linux-amd64 /opt/bazelisk/bazel
  54. #
  55. # install clang+llvm
  56. RUN cd /etc/apt/apt.conf.d \
  57. && touch 99verfiy-peer.conf \
  58. && echo "Acquire { https::Verify-Peer false }" > 99verfiy-peer.conf
  59. RUN cd /tmp \
  60. && wget https://apt.llvm.org/llvm.sh \
  61. && chmod a+x ./llvm.sh
  62. RUN /tmp/llvm.sh 12 all
  63. RUN ln -sf /usr/bin/clang-format-12 /usr/bin/clang-format
  64. #
  65. # [Optional]
  66. #
  67. # Install pip
  68. RUN apt update && apt install -y --reinstall python3-venv python3-pip
  69. RUN python3 -m pip install --upgrade pip
  70. #
  71. # Install required python packages
  72. RUN pip3 install --user black nose pycparser pylint
  73. # set path
  74. ENV PATH "/opt/bazelisk:/opt/clang-llvm/bin:${PATH}"
  75. RUN echo "export PATH=/opt/bazelisk:/opt/clang-llvm/bin:${PATH}" >> /root/.bashrc
  76. #
  77. # PS
  78. RUN echo "PS1='\n[ \u@wamr-dev-docker \W ]\n$ '" >> /root/.bashrc
  79. # Clean up
  80. RUN apt-get autoremove -y \
  81. && apt-get clean -y \
  82. && rm -rf /var/lib/apt/lists/* \
  83. && rm -rf /tmp/*