From 93681077ad458986caf2ba5cb5dcf6f86cb29a03 Mon Sep 17 00:00:00 2001 From: Haiko Schol Date: Thu, 14 Mar 2024 18:47:05 +0700 Subject: [PATCH] feat(docker): Add Bazel to runtime image and env path Signed-off-by: Haiko Schol --- Dockerfile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Dockerfile b/Dockerfile index e65310703e364..45ff874608332 100644 --- a/Dockerfile +++ b/Dockerfile @@ -403,6 +403,25 @@ RUN mkdir -p $DOTNET_HOME/bin \ FROM scratch AS dotnet COPY --from=dotnetbuild /opt/dotnet /opt/dotnet +#------------------------------------------------------------------------ +# BAZEL +FROM base as bazelbuild + +ARG BAZEL_VERSION=7.0.1 + +ENV BAZEL_HOME=/opt/bazel + +RUN mkdir -p $BAZEL_HOME/bin \ + && if [ "$(arch)" = "aarch64" ]; then \ + curl -L https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-linux-arm64 -o $BAZEL_HOME/bin/bazel; \ + else \ + curl -L https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-linux-x86_64 -o $BAZEL_HOME/bin/bazel; \ + fi \ + && chmod a+x $BAZEL_HOME/bin/bazel + +FROM scratch as bazel +COPY --from=bazelbuild /opt/bazel /opt/bazel + #------------------------------------------------------------------------ # ORT FROM base as ortbuild @@ -564,3 +583,11 @@ ENV PATH=$PATH:$HASKELL_HOME/bin COPY --from=haskell /opt/haskell /opt/haskell RUN syft /opt/haskell -o spdx-json --file /usr/share/doc/ort/ort-haskell.spdx.json + +# Bazel +ENV BAZEL_HOME=/opt/bazel +ENV PATH=$PATH:$BAZEL_HOME/bin + +COPY --from=bazel $BAZEL_HOME $BAZEL_HOME + +RUN syft $BAZEL_HOME -o spdx-json --file /usr/share/doc/ort/ort-bazel.spdx.json