aboutsummaryrefslogtreecommitdiff
path: root/docker/install/install_bazel.sh
diff options
context:
space:
mode:
Diffstat (limited to 'docker/install/install_bazel.sh')
-rwxr-xr-xdocker/install/install_bazel.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/docker/install/install_bazel.sh b/docker/install/install_bazel.sh
new file mode 100755
index 0000000..687ed13
--- /dev/null
+++ b/docker/install/install_bazel.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+# SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates.
+# SPDX-License-Identifier: Apache-2.0
+BAZEL_VERSION="$1"
+shift
+
+set +e
+local_bazel_ver=$(bazel version 2>&1 | grep -i label | awk '{print $3}')
+
+if [[ "$local_bazel_ver" == "$BAZEL_VERSION" ]]; then
+ exit 0
+fi
+
+set -e
+
+# Install Bazelâ„¢
+mkdir -p /bazel
+cd /bazel
+if [[ ! -f "bazel-$BAZEL_VERSION-installer-linux-x86_64.sh" ]]; then
+ curl -fSsL -O https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh
+fi
+chmod +x /bazel/bazel-*.sh
+/bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh
+rm -f /bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh