From f130e1e8a49bf339b0165eaa2c7d477bf843111b Mon Sep 17 00:00:00 2001 From: ashione Date: Sat, 6 Apr 2024 22:05:07 +0800 Subject: [PATCH] install bazel script remove download resources --- docker/Dockerfile-dev | 4 ++-- scripts/install-bazel.sh | 26 ++++++++++++++++++-------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/docker/Dockerfile-dev b/docker/Dockerfile-dev index 17bf3ac..49bfe11 100644 --- a/docker/Dockerfile-dev +++ b/docker/Dockerfile-dev @@ -2,8 +2,8 @@ FROM ubuntu:22.04 RUN apt-get update RUN apt-get install -yq software-properties-common RUN add-apt-repository -y ppa:deadsnakes/ppa -RUN apt-get install -yq wget gcc g++ openjdk-8-jdk maven python3.8 zlib1g-dev zip git pip -RUN git clone https://github.com/ray-project/mobius.git +RUN DEBIAN_FRONTEND=noninteractive apt-get install -yq wget gcc g++ openjdk-8-jdk maven python3.8 zlib1g-dev zip git pip +RUN git clone -b dev-docker-builder https://github.com/ray-project/mobius.git RUN sh -c "bash mobius/scripts/install-bazel.sh" RUN python3 -m pip install virtualenv RUN python3 -m virtualenv -p python3 py3 diff --git a/scripts/install-bazel.sh b/scripts/install-bazel.sh index b1ff7db..6d22449 100755 --- a/scripts/install-bazel.sh +++ b/scripts/install-bazel.sh @@ -29,20 +29,30 @@ if [ "${arm}" = "aarch64" ]; then arm="arm64" fi +bazel_exe_file="" + if [ "${platform}" = "darwin" ] && [ "${arm}" != "arm64" ]; then - wget "https://github.com/bazelbuild/bazel/releases/download/5.4.1/bazel-5.4.1-installer-darwin-x86_64.sh" -O bazel-5.4.1-installer-darwin-x86_64.sh - sh bazel-5.4.1-installer-darwin-x86_64.sh + bazel_exe_file="bazel-5.4.1-installer-darwin-x86_64.sh" + wget "https://github.com/bazelbuild/bazel/releases/download/5.4.1/bazel-5.4.1-installer-darwin-x86_64.sh" -O $bazel_exe_file + sh $bazel_exe_file elif [ "${platform}" = "darwin" ] && [ "${arm}" = "arm64" ]; then wget "https://github.com/bazelbuild/bazel/releases/download/5.4.1/bazel-5.4.1-darwin-arm64" -O bazel-5.4.1-darwin-arm64 chmod a+x bazel-5.4.1-darwin-arm64 - sh bazel-5.4.1-darwin-arm64 + cp bazel-5.4.1-darwin-arm64 /usr/bin/bazel elif [ "${platform}" = "linux" ] && [ "${arm}" = "arm64" ]; then - wget "https://github.com/bazelbuild/bazel/releases/download/5.4.1/bazel-5.4.1-linux-arm64" -O bazel_5.4.1-linux-arm64 - chmod a+x bazel_5.4.1-linux-arm64 - sh bazel_5.4.1-linux-arm64 + bazel_exe_file="bazel_5.4.1-linux-arm64" + wget "https://github.com/bazelbuild/bazel/releases/download/5.4.1/bazel-5.4.1-linux-arm64" -O $bazel_exe_file + chmod a+x $bazel_exe_file + cp $bazel_exe_file /usr/bin/bazel else - wget "https://github.com/bazelbuild/bazel/releases/download/5.4.1/bazel_5.4.1-linux-x86_64.deb" -O bazel_5.4.1-linux-x86_64.deb - dpkg -i bazel_5.4.1-linux-x86_64.deb + bazel_exe_file="bazel_5.4.1-linux-x86_64.deb" + wget "https://github.com/bazelbuild/bazel/releases/download/5.4.1/bazel_5.4.1-linux-x86_64.deb" -O $bazel_exe_file + dpkg -i $bazel_exe_file +fi + +if [ -e $bazel_exe_file ]; then + echo "Remove download file $bazel_exe_file" + rm $bazel_exe_file fi bazel --version