docker_build.sh 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #
  2. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #
  5. #!/bin/bash
  6. BUILD_CONTENT="/tmp/build_content"
  7. if [[ ! -d ${BUILD_CONTENT} ]]; then
  8. mkdir ${BUILD_CONTENT}
  9. fi
  10. WASI_SDK_VER=11.0
  11. WABT_VER=1.0.19
  12. CMAKE_VER=3.16.2
  13. BINARYEN_VER=version_97
  14. BAZEL_VER=3.7.0
  15. cd ${BUILD_CONTENT}
  16. if [[ ! -f wasi-sdk-${WASI_SDK_VER}-linux.tar.gz ]]; then
  17. wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-11/wasi-sdk-${WASI_SDK_VER}-linux.tar.gz
  18. fi
  19. if [[ ! -f wabt-${WABT_VER}-ubuntu.tar.gz ]]; then
  20. wget https://github.com/WebAssembly/wabt/releases/download/${WABT_VER}/wabt-${WABT_VER}-ubuntu.tar.gz
  21. fi
  22. if [[ ! -f llvm.sh ]]; then
  23. wget https://apt.llvm.org/llvm.sh
  24. fi
  25. if [[ ! -f cmake-${CMAKE_VER}-Linux-x86_64.sh ]]; then
  26. wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-Linux-x86_64.sh
  27. fi
  28. if [[ ! -f binaryen-${BINARYEN_VER}-x86_64-linux.tar.gz ]]; then
  29. wget https://github.com/WebAssembly/binaryen/releases/download/${BINARYEN_VER}/binaryen-${BINARYEN_VER}-x86_64-linux.tar.gz
  30. fi
  31. if [[ ! -f bazel-${BAZEL_VER}-installer-linux-x86_64.sh ]]; then
  32. wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VER}/bazel-${BAZEL_VER}-installer-linux-x86_64.sh
  33. fi
  34. cd - > /dev/null
  35. DOCKERFILE_PATH=$(dirname $(realpath $0))
  36. docker build \
  37. --build-arg http_proxy=${http_proxy} \
  38. --build-arg https_proxy=${https_proxy} \
  39. --build-arg HTTP_PROXY=${http_proxy} \
  40. --build-arg HTTPS_PROXY=${https_proxy} \
  41. --build-arg WASI_SDK_VER=${WASI_SDK_VER} \
  42. --build-arg WABT_VER=${WABT_VER} \
  43. --build-arg CMAKE_VER=${CMAKE_VER} \
  44. --build-arg BINARYEN_VER=${BINARYEN_VER} \
  45. --build-arg BAZEL_VER=${BAZEL_VER} \
  46. -t clang_env:0.1 -f ${DOCKERFILE_PATH}/Dockerfile ${BUILD_CONTENT}
  47. docker run --rm -it \
  48. -e http_proxy=${http_proxy} \
  49. -e https_proxy=${https_proxy} \
  50. -e HTTP_PROXY=${http_proxy} \
  51. -e HTTPS_PROXY=${htpps_proxy} \
  52. --name workload_w_clang \
  53. --mount type=bind,source=$(pwd),target=/data/project \
  54. --mount type=bind,source=$(pwd)/../cmake,target=/data/cmake \
  55. -w /data/project \
  56. clang_env:0.1 \
  57. /bin/bash -c /build.sh