Dockerfile 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. # tie the ${VARIANT} and a llvm binary release together
  4. # please find a matched version on https://github.com/llvm/llvm-project/releases
  5. ARG VARIANT=focal
  6. FROM ubuntu:${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 (may not necessary ?)
  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 clang and llvm release
  35. ARG CLANG_VER=13.0.0
  36. RUN wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${CLANG_VER}/clang+llvm-${CLANG_VER}-x86_64-linux-gnu-ubuntu-20.04.tar.xz -P /opt
  37. RUN cd /opt \
  38. && tar xf clang+llvm-${CLANG_VER}-x86_64-linux-gnu-ubuntu-20.04.tar.xz \
  39. && ln -sf clang+llvm-${CLANG_VER}-x86_64-linux-gnu-ubuntu-20.04 clang-llvm
  40. RUN rm /opt/clang+llvm-${CLANG_VER}-x86_64-linux-gnu-ubuntu-20.04.tar.xz
  41. #
  42. # install wasi-sdk
  43. ARG WASI_SDK_VER=14
  44. 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
  45. RUN tar xf /opt/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz -C /opt \
  46. && ln -fs /opt/wasi-sdk-${WASI_SDK_VER}.0 /opt/wasi-sdk
  47. RUN rm /opt/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz
  48. #
  49. #install wabt
  50. ARG WABT_VER=1.0.24
  51. RUN wget -c https://github.com/WebAssembly/wabt/releases/download/${WABT_VER}/wabt-${WABT_VER}-ubuntu.tar.gz -P /opt
  52. RUN tar xf /opt/wabt-${WABT_VER}-ubuntu.tar.gz -C /opt \
  53. && ln -fs /opt/wabt-${WABT_VER} /opt/wabt
  54. RUN rm /opt/wabt-${WABT_VER}-ubuntu.tar.gz
  55. #
  56. # install bazelisk
  57. ARG BAZELISK_VER=1.10.1
  58. RUN mkdir /opt/bazelisk
  59. RUN wget -c https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VER}/bazelisk-linux-amd64 -P /opt/bazelisk
  60. RUN chmod a+x /opt/bazelisk/bazelisk-linux-amd64 \
  61. && ln -fs /opt/bazelisk/bazelisk-linux-amd64 /opt/bazelisk/bazel
  62. #
  63. # install
  64. RUN apt update && apt install -y clang-format
  65. # set path
  66. ENV PATH "$PATH:/opt/wasi-sdk/bin:/opt/wabt/bin:/opt/binaryen/bin:/opt/bazelisk:/opt/clang-llvm/bin"
  67. RUN echo "export PATH=/opt/wasi-sdk/bin:/opt/wabt/bin:/opt/binaryen/bin:/opt/bazelisk:/opt/clang-llvm/bin:${PATH}" >> /root/.bashrc
  68. #
  69. # PS
  70. RUN echo "PS1='\n[ \u@wamr-dev-docker \W ]\n$ '" >> /root/.bashrc
  71. # Clean up
  72. RUN apt-get autoremove -y \
  73. && apt-get clean -y \
  74. && rm -rf /var/lib/apt/lists/* \
  75. && rm -rf /tmp/*
  76. VOLUME /workspace
  77. WORKDIR /workspace