@@ -18,18 +18,20 @@ RUN apt-get update && apt-get install -y \
18
18
&& apt-get clean && \
19
19
rm -rf /var/lib/apt/lists/*
20
20
21
- # Install Bazel
22
- ARG BAZEL_VERSION=5.3.0
23
- RUN wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh && \
24
- chmod +x bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh && \
25
- ./bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh && \
26
- rm bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh
27
-
28
- # Install Bazelisk as fallback for any version requirements
29
- RUN wget https://github.com/bazelbuild/bazelisk/releases/download/v1.18.0/bazelisk-linux-amd64 && \
30
- chmod +x bazelisk-linux-amd64 && \
31
- mv bazelisk-linux-amd64 /usr/local/bin/bazelisk && \
32
- ln -sf /usr/local/bin/bazelisk /usr/local/bin/bazel.real
21
+ # Install Bazelisk to handle automatic Bazel version management
22
+ RUN ARCH=$(uname -m) && \
23
+ if [ "$ARCH" = "x86_64" ]; then \
24
+ wget https://github.com/bazelbuild/bazelisk/releases/download/v1.18.0/bazelisk-linux-amd64 -O bazelisk; \
25
+ elif [ "$ARCH" = "aarch64" ]; then \
26
+ wget https://github.com/bazelbuild/bazelisk/releases/download/v1.18.0/bazelisk-linux-arm64 -O bazelisk; \
27
+ else \
28
+ echo "Unsupported architecture: $ARCH" ; \
29
+ exit 1; \
30
+ fi && \
31
+ chmod +x bazelisk && \
32
+ mv bazelisk /usr/local/bin/bazel && \
33
+ # Set USE_BAZEL_VERSION to ensure bazelisk downloads the right version
34
+ echo "export USE_BAZEL_VERSION=7.4.1" >> /etc/bash.bashrc
33
35
34
36
# Set up Android SDK and NDK
35
37
ENV ANDROID_DEV_HOME=/android
@@ -89,6 +91,7 @@ ENV TF_NEED_ROCM=0
89
91
ENV TF_DOWNLOAD_CLANG=0
90
92
ENV TF_SET_ANDROID_WORKSPACE=1
91
93
ENV TF_CONFIGURE_IOS=0
94
+ ENV USE_BAZEL_VERSION=7.4.1
92
95
93
96
# Set NDK version for configuration
94
97
ENV ANDROID_NDK_VERSION=25
@@ -134,7 +137,6 @@ build --action_env ANDROID_SDK_API_LEVEL="${ANDROID_SDK_API_LEVEL}"\n\
134
137
build --action_env ANDROID_NDK_API_LEVEL="${ANDROID_NDK_API_LEVEL}"\n \
135
138
build --action_env ANDROID_NDK_VERSION="${ANDROID_NDK_VERSION}"\n \
136
139
build --action_env TF_CONFIGURE_IOS="${TF_CONFIGURE_IOS}"\n \
137
- build --distinct_host_configuration=false\n \
138
140
EOL\n \
139
141
\n \
140
142
echo "Configuration complete. .tf_configure.bazelrc has been generated at /litert_build/.tf_configure.bazelrc"\n \
@@ -151,4 +153,4 @@ COPY verify_android_env.sh /verify_android_env.sh
151
153
RUN chmod +x /verify_android_env.sh
152
154
153
155
# Default command
154
- CMD ["bash" , "-c" , "./verify_android_env.sh && bazel build //litert/runtime:metrics" ]
156
+ CMD ["bash" , "-c" , "./verify_android_env.sh && USE_BAZEL_VERSION=7.4.1 bazel build //litert/runtime:metrics" ]
0 commit comments