Dockerfile 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. # hadolint ignore=DL3008
  10. RUN apt-get update \
  11. && apt-get install -y apt-transport-https apt-utils build-essential \
  12. ca-certificates curl g++-multilib git gnupg \
  13. libgcc-9-dev lib32gcc-9-dev lsb-release \
  14. ninja-build ocaml ocamlbuild python2.7 \
  15. software-properties-common tree tzdata \
  16. unzip valgrind vim wget zip --no-install-recommends \
  17. && apt-get clean -y \
  18. && rm -rf /var/lib/apt/lists/*
  19. #
  20. # CMAKE (https://apt.kitware.com/)
  21. SHELL ["/bin/bash", "-o", "pipefail", "-c"]
  22. # hadolint ignore=DL3008
  23. 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 \
  24. && 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 \
  25. && apt-get update \
  26. && rm /usr/share/keyrings/kitware-archive-keyring.gpg \
  27. && apt-get install -y kitware-archive-keyring --no-install-recommends \
  28. && apt-get install -y cmake --no-install-recommends \
  29. && apt-get clean -y \
  30. && rm -rf /var/lib/apt/lists/*
  31. #
  32. # install emsdk
  33. WORKDIR /opt
  34. RUN git clone https://github.com/emscripten-core/emsdk.git
  35. WORKDIR /opt/emsdk
  36. RUN git pull \
  37. && ./emsdk install 2.0.26 \
  38. && ./emsdk activate 2.0.26 \
  39. && echo "source /opt/emsdk/emsdk_env.sh" >> /root/.bashrc
  40. #
  41. # install wasi-sdk
  42. ARG WASI_SDK_VER=16
  43. 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 \
  44. && tar xf /opt/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz -C /opt \
  45. && ln -fs /opt/wasi-sdk-${WASI_SDK_VER}.0 /opt/wasi-sdk \
  46. && rm /opt/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz
  47. #
  48. #install wabt
  49. ARG WABT_VER=1.0.29
  50. RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/${WABT_VER}/wabt-${WABT_VER}-ubuntu.tar.gz -P /opt \
  51. && tar xf /opt/wabt-${WABT_VER}-ubuntu.tar.gz -C /opt \
  52. && ln -fs /opt/wabt-${WABT_VER} /opt/wabt \
  53. && rm /opt/wabt-${WABT_VER}-ubuntu.tar.gz
  54. #
  55. # install bazelisk
  56. ARG BAZELISK_VER=1.12.0
  57. RUN mkdir /opt/bazelisk \
  58. && wget -c --progress=dot:giga https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VER}/bazelisk-linux-amd64 -P /opt/bazelisk \
  59. && chmod a+x /opt/bazelisk/bazelisk-linux-amd64 \
  60. && ln -fs /opt/bazelisk/bazelisk-linux-amd64 /opt/bazelisk/bazel
  61. #
  62. # install clang+llvm
  63. WORKDIR /etc/apt/apt.conf.d
  64. RUN touch 99verfiy-peer.conf \
  65. && echo "Acquire { https::Verify-Peer false }" > 99verfiy-peer.conf
  66. WORKDIR /tmp
  67. RUN wget --progress=dot:giga https://apt.llvm.org/llvm.sh \
  68. && chmod a+x ./llvm.sh \
  69. && /tmp/llvm.sh 12 all \
  70. && ln -sf /usr/bin/clang-format-12 /usr/bin/clang-format \
  71. && rm -rf /tmp/*
  72. #
  73. # [Optional]
  74. #
  75. # Install pip
  76. # hadolint ignore=DL3008
  77. RUN apt-get update \
  78. && apt-get install -y --reinstall python3-venv python3-pip --no-install-recommends \
  79. && apt-get clean -y \
  80. && rm -rf /var/lib/apt/lists/*
  81. #
  82. # Install required python packages
  83. # hadolint ignore=DL3013
  84. RUN python3 -m pip install --no-cache-dir --upgrade pip \
  85. && pip3 install --no-cache-dir --user black nose pycparser pylint
  86. # set path, PS and clean up
  87. ENV PATH "/opt/bazelisk:/opt/clang-llvm/bin:${PATH}"
  88. RUN echo "export PATH=/opt/bazelisk:/opt/clang-llvm/bin:${PATH}" >> /root/.bashrc \
  89. && printf "%s\n" "PS1='\n[ \u@wamr-dev-docker \W ]\n$ '" >> /root/.bashrc \
  90. && apt-get autoremove -y \
  91. && apt-get clean -y \
  92. && rm -rf /var/lib/apt/lists/* \
  93. && rm -rf /tmp/*
  94. # set workdir when container run
  95. VOLUME /workspace
  96. WORKDIR /workspace