diff --git a/ml_metadata/tools/docker_server/Dockerfile b/ml_metadata/tools/docker_server/Dockerfile index 52cbff8f5..ea81fc529 100644 --- a/ml_metadata/tools/docker_server/Dockerfile +++ b/ml_metadata/tools/docker_server/Dockerfile @@ -40,19 +40,29 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ ENV BAZEL_VERSION 7.7.0 WORKDIR / RUN mkdir /bazel && \ - cd /bazel && \ - curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -O https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \ - curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -o /bazel/LICENSE.txt https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE && \ - chmod +x bazel-*.sh && \ - ./bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \ - cd / && \ - rm -f /bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh + ARCH=$(dpkg --print-architecture) && \ + curl -H "User-Agent: Mozilla/5.0" -fSsL -o /usr/local/bin/bazel \ + https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-linux-${ARCH} && \ + curl -H "User-Agent: Mozilla/5.0" -fSsL -o /bazel/LICENSE.txt \ + https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE && \ + chmod +x /usr/local/bin/bazel ADD . /mlmd-src WORKDIR /mlmd-src # "-std=c++17" is needed in order to build with ZetaSQL. -RUN bazel build -c opt --action_env=PATH \ +# Abseil's stacktrace.cc emits the ARMv8.3 pointer-authentication instruction +# xpaclri, which the assembler rejects at the default armv8-a baseline. The +# flag is only valid on aarch64, so it is selected by architecture. Note both +# --copt and --host_copt are needed: the failing target is built in the exec +# configuration, which --copt does not affect. +RUN ARCH=$(dpkg --print-architecture) && \ + if [ "$ARCH" = "arm64" ]; then \ + MARCH_FLAGS="--copt=-march=armv8.3-a --host_copt=-march=armv8.3-a"; \ + else \ + MARCH_FLAGS=""; \ + fi && \ + bazel build -c opt --action_env=PATH $MARCH_FLAGS \ --define=grpc_no_ares=true \ //ml_metadata/metadata_store:metadata_store_server --cxxopt="-std=c++17"