Dockerfile 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. FROM ubuntu:18.04 as builder
  2. RUN apt update \
  3. && apt install -y lsb-release software-properties-common build-essential \
  4. wget curl git tree zip unzip
  5. #
  6. # install clang and llvm
  7. # COPY llvm.sh /tmp
  8. # RUN apt update \
  9. # && apt install -y lsb-release wget software-properties-common build-essential \
  10. # && cd /tmp \
  11. # && chmod a+x llvm.sh \
  12. # && ./llvm.sh 11
  13. ARG WASI_SDK_VER=12
  14. ARG WABT_VER=1.0.20
  15. ARG CMAKE_VER=3.16.2
  16. ARG BINARYEN_VER=version_97
  17. ARG BAZEL_VER=3.7.0
  18. #
  19. # install wasi-sdk
  20. ARG WASI_SDK_FILE="wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz"
  21. COPY ${WASI_SDK_FILE} /opt
  22. RUN cd /opt \
  23. && tar zxf ${WASI_SDK_FILE} \
  24. && rm ${WASI_SDK_FILE} \
  25. && ln -sf /opt/wasi-sdk-${WASI_SDK_VER}.0 /opt/wasi-sdk
  26. #
  27. # install wabt
  28. ARG WABT_FILE="wabt-${WABT_VER}-ubuntu.tar.gz"
  29. COPY ${WABT_FILE} /opt
  30. RUN cd /opt \
  31. && tar zxf ${WABT_FILE} \
  32. && rm ${WABT_FILE} \
  33. && ln -sf /opt/wabt-${WABT_VER} /opt/wabt
  34. #
  35. # install cmake
  36. ARG CMAKE_FILE="cmake-${CMAKE_VER}-Linux-x86_64.sh"
  37. COPY ${CMAKE_FILE} /tmp
  38. RUN cd /tmp \
  39. && chmod a+x ${CMAKE_FILE} \
  40. && mkdir /opt/cmake \
  41. && ./${CMAKE_FILE} --prefix=/opt/cmake --skip-license \
  42. && ln -sf /opt/cmake/bin/cmake /usr/local/bin/cmake
  43. #
  44. # install emsdk
  45. RUN cd /opt \
  46. && git clone https://github.com/emscripten-core/emsdk.git \
  47. && cd emsdk \
  48. && git pull \
  49. && ./emsdk install latest \
  50. && ./emsdk activate latest \
  51. && echo "source /opt/emsdk/emsdk_env.sh" >> /root/.bashrc
  52. #
  53. # install binaryen
  54. ARG BINARYEN_FILE="binaryen-${BINARYEN_VER}-x86_64-linux.tar.gz"
  55. COPY ${BINARYEN_FILE} /opt
  56. RUN cd /opt \
  57. && tar zxf ${BINARYEN_FILE} \
  58. && rm ${BINARYEN_FILE} \
  59. && ln -sf /opt/binaryen-${BINARYEN_VER} /opt/binaryen
  60. # #
  61. # # install bazel
  62. # ARG BAZEL_FILE=bazel-${BAZEL_VER}-installer-linux-x86_64.sh
  63. # COPY ${BAZEL_FILE} /tmp
  64. # RUN cd /tmp \
  65. # && chmod a+x ${BAZEL_FILE} \
  66. # && ./${BAZEL_FILE}
  67. #
  68. # Clean up
  69. RUN apt-get autoremove -y \
  70. && apt-get clean -y \
  71. && rm -rf /var/lib/apt/lists/* \
  72. && rm -rf /tmp/*
  73. VOLUME /data
  74. #
  75. #
  76. RUN touch /build.sh \
  77. && echo "\
  78. #!/bin/bash \n\
  79. if [[ -d /data/project/build ]]; then \n\
  80. rm -r /data/project/build \n\
  81. fi \n\
  82. mkdir /data/project/build \n\
  83. cd /data/project/build \n\
  84. source /opt/emsdk/emsdk_env.sh \n\
  85. cmake .. \n\
  86. make \n\
  87. cd - > /dev/null" > /build.sh \
  88. && chmod a+x /build.sh