build.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. #!/bin/bash
  4. # 1. verify the environment: vscode & docker
  5. # 1.1 if docker is installed, config docker command execution without sudo, promp if not installed and exit.
  6. # 1.2 if vscode is not installed, promp and exit.
  7. # 2. build wasm-toolchain & wasm-debug-server docker image
  8. DIR_ROOT=$(pwd)/..
  9. echo "=== Verify the vscode status ==="
  10. if [ "$(code --version)" ]; then
  11. echo "VSCode is ready."
  12. else
  13. echo "VSCode is not installed, please install firstly."
  14. exit 1
  15. fi
  16. echo "=== Verify the docker status ==="
  17. if [ "$(docker --version)" ]; then
  18. echo "Docker is ready."
  19. else
  20. echo "Docker is not installed, please install firstly."
  21. exit 1
  22. fi
  23. # setup docker command exectuion without sudo permission
  24. sudo groupadd docker
  25. sudo gpasswd -a ${USER} docker
  26. sudo service docker restart
  27. # create new group and execute the rest commands
  28. newgrp - docker << REST
  29. # 2. build wasm-debug-server docker image
  30. cd ${DIR_ROOT}/WASM-Debug-Server/Docker
  31. docker build -t wasm-debug-server:1.0 .
  32. # 3. build wasm-toolchain docker image
  33. cd ${DIR_ROOT}/WASM-Toolchain/Docker
  34. docker pull ubuntu:20.04
  35. docker build -t wasm-toolchain:1.0 .
  36. REST