From f0330ec4047db2c2ca104969c60d0a9b5adae4f8 Mon Sep 17 00:00:00 2001 From: Mizux Seiha Date: Tue, 16 Sep 2025 15:54:33 +0200 Subject: [PATCH] bazel: rework docker ci --- bazel/docker/almalinux/Dockerfile | 17 ++++++----------- bazel/docker/alpine/Dockerfile | 10 ++-------- bazel/docker/archlinux/Dockerfile | 10 ++-------- bazel/docker/debian/Dockerfile | 23 +++++++---------------- bazel/docker/fedora/Dockerfile | 17 ++++++----------- bazel/docker/opensuse/Dockerfile | 17 ++++++----------- bazel/docker/rockylinux/Dockerfile | 17 ++++++----------- bazel/docker/ubuntu/Dockerfile | 24 +++++++----------------- 8 files changed, 42 insertions(+), 93 deletions(-) diff --git a/bazel/docker/almalinux/Dockerfile b/bazel/docker/almalinux/Dockerfile index 221755fc26..527fef22a5 100644 --- a/bazel/docker/almalinux/Dockerfile +++ b/bazel/docker/almalinux/Dockerfile @@ -14,10 +14,11 @@ RUN echo "source /opt/rh/gcc-toolset-13/enable" >> /etc/bashrc SHELL ["/bin/bash", "--login", "-c"] # Install Bazelisk +ARG TARGETARCH=amd64 RUN wget \ -https://github.com/bazelbuild/bazelisk/releases/download/v1.25.0/bazelisk-linux-amd64 \ -&& chmod +x bazelisk-linux-amd64 \ -&& mv bazelisk-linux-amd64 /usr/local/bin/bazel +https://github.com/bazelbuild/bazelisk/releases/download/v1.27.0/bazelisk-linux-${TARGETARCH} \ +&& chmod +x bazelisk-linux-${TARGETARCH} \ +&& mv bazelisk-linux-${TARGETARCH} /usr/local/bin/bazel # Install Java RUN dnf -y update \ @@ -38,13 +39,7 @@ COPY . . FROM devel AS build RUN bazel version -RUN bazel build \ - -c opt \ - --subcommands=true \ - //ortools/... //examples/... +RUN bazel build --config=ci //ortools/... //examples/... FROM build AS test -RUN bazel test \ - -c opt \ - --test_output=errors \ - //ortools/... //examples/... +RUN bazel test --config=ci //ortools/... //examples/... diff --git a/bazel/docker/alpine/Dockerfile b/bazel/docker/alpine/Dockerfile index 5908e0fb03..1427921dfc 100644 --- a/bazel/docker/alpine/Dockerfile +++ b/bazel/docker/alpine/Dockerfile @@ -20,13 +20,7 @@ COPY . . FROM devel AS build RUN bazel version -RUN bazel build \ - -c opt \ - --subcommands=true \ - //ortools/... //examples/... +RUN bazel build --config=ci //ortools/... //examples/... FROM build AS test -RUN bazel test \ - -c opt \ - --test_output=errors \ - //ortools/... //examples/... +RUN bazel test --config=ci //ortools/... //examples/... diff --git a/bazel/docker/archlinux/Dockerfile b/bazel/docker/archlinux/Dockerfile index 727cc90a77..a72afc6b46 100644 --- a/bazel/docker/archlinux/Dockerfile +++ b/bazel/docker/archlinux/Dockerfile @@ -16,13 +16,7 @@ COPY . . FROM devel AS build RUN bazel version -RUN bazel build \ - -c opt \ - --subcommands=true \ - //ortools/... //examples/... +RUN bazel build --config=ci //ortools/... //examples/... FROM build AS test -RUN bazel test \ - -c opt \ - --test_output=errors \ - //ortools/... //examples/... +RUN bazel test --config=ci //ortools/... //examples/... diff --git a/bazel/docker/debian/Dockerfile b/bazel/docker/debian/Dockerfile index 798da5d08e..cf2a664382 100644 --- a/bazel/docker/debian/Dockerfile +++ b/bazel/docker/debian/Dockerfile @@ -10,15 +10,12 @@ RUN apt-get update -qq \ && apt-get install -yq default-jdk \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -# Install Bazel -RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add - +# Install Bazelisk ARG TARGETARCH=amd64 -RUN echo "deb [arch=$TARGETARCH] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list -RUN apt-get update -qq \ -&& apt-get install -yq bazel \ -&& apt-get clean \ -&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN wget \ +https://github.com/bazelbuild/bazelisk/releases/download/v1.27.0/bazelisk-linux-${TARGETARCH} \ +&& chmod +x bazelisk-linux-${TARGETARCH} \ +&& mv bazelisk-linux-${TARGETARCH} /usr/local/bin/bazel FROM env AS devel WORKDIR /home/project @@ -26,13 +23,7 @@ COPY . . FROM devel AS build RUN bazel version -RUN bazel build \ - -c opt \ - --subcommands=true \ - //ortools/... //examples/... +RUN bazel build --config=ci //ortools/... //examples/... FROM build AS test -RUN bazel test \ - -c opt \ - --test_output=errors \ - //ortools/... //examples/... +RUN bazel test --config=ci //ortools/... //examples/... diff --git a/bazel/docker/fedora/Dockerfile b/bazel/docker/fedora/Dockerfile index f65861728f..fc3cb001aa 100644 --- a/bazel/docker/fedora/Dockerfile +++ b/bazel/docker/fedora/Dockerfile @@ -13,10 +13,11 @@ RUN dnf -y update \ && dnf clean all # Install Bazelisk +ARG TARGETARCH=amd64 RUN wget \ -https://github.com/bazelbuild/bazelisk/releases/download/v1.25.0/bazelisk-linux-amd64 \ -&& chmod +x bazelisk-linux-amd64 \ -&& mv bazelisk-linux-amd64 /usr/local/bin/bazel +https://github.com/bazelbuild/bazelisk/releases/download/v1.27.0/bazelisk-linux-${TARGETARCH} \ +&& chmod +x bazelisk-linux-${TARGETARCH} \ +&& mv bazelisk-linux-${TARGETARCH} /usr/local/bin/bazel # Install Java RUN dnf -y update \ @@ -35,13 +36,7 @@ COPY . . FROM devel AS build RUN bazel version -RUN bazel build \ - -c opt \ - --subcommands=true \ - //ortools/... //examples/... +RUN bazel build --config=ci //ortools/... //examples/... FROM build AS test -RUN bazel test \ - -c opt \ - --test_output=errors \ - //ortools/... //examples/... +RUN bazel test --config=ci //ortools/... //examples/... diff --git a/bazel/docker/opensuse/Dockerfile b/bazel/docker/opensuse/Dockerfile index 0e45533185..0b66dae1af 100644 --- a/bazel/docker/opensuse/Dockerfile +++ b/bazel/docker/opensuse/Dockerfile @@ -10,10 +10,11 @@ RUN zypper update -y \ ENV CC=gcc CXX=g++ # Install Bazelisk +ARG TARGETARCH=amd64 RUN wget \ -https://github.com/bazelbuild/bazelisk/releases/download/v1.25.0/bazelisk-linux-amd64 \ -&& chmod +x bazelisk-linux-amd64 \ -&& mv bazelisk-linux-amd64 /usr/local/bin/bazel +https://github.com/bazelbuild/bazelisk/releases/download/v1.27.0/bazelisk-linux-${TARGETARCH} \ +&& chmod +x bazelisk-linux-${TARGETARCH} \ +&& mv bazelisk-linux-${TARGETARCH} /usr/local/bin/bazel # Install Java JDK and Maven RUN zypper refresh \ @@ -32,13 +33,7 @@ COPY . . FROM devel AS build RUN bazel version -RUN bazel build \ - -c opt \ - --subcommands=true \ - //ortools/... //examples/... +RUN bazel build --config=ci //ortools/... //examples/... FROM build AS test -RUN bazel test \ - -c opt \ - --test_output=errors \ - //ortools/... //examples/... +RUN bazel test --config=ci //ortools/... //examples/... diff --git a/bazel/docker/rockylinux/Dockerfile b/bazel/docker/rockylinux/Dockerfile index 7e9e76e680..94c0901f8c 100644 --- a/bazel/docker/rockylinux/Dockerfile +++ b/bazel/docker/rockylinux/Dockerfile @@ -14,10 +14,11 @@ RUN echo "source /opt/rh/gcc-toolset-13/enable" >> /etc/bashrc SHELL ["/bin/bash", "--login", "-c"] # Install Bazelisk +ARG TARGETARCH=amd64 RUN wget \ -https://github.com/bazelbuild/bazelisk/releases/download/v1.25.0/bazelisk-linux-amd64 \ -&& chmod +x bazelisk-linux-amd64 \ -&& mv bazelisk-linux-amd64 /usr/local/bin/bazel +https://github.com/bazelbuild/bazelisk/releases/download/v1.27.0/bazelisk-linux-${TARGETARCH} \ +&& chmod +x bazelisk-linux-${TARGETARCH} \ +&& mv bazelisk-linux-${TARGETARCH} /usr/local/bin/bazel # Install Java RUN dnf -y update \ @@ -38,13 +39,7 @@ COPY . . FROM devel AS build RUN bazel version -RUN bazel build \ - -c opt \ - --subcommands=true \ - //ortools/... //examples/... +RUN bazel build --config=ci //ortools/... //examples/... FROM build AS test -RUN bazel test \ - -c opt \ - --test_output=errors \ - //ortools/... //examples/... +RUN bazel test --config=ci //ortools/... //examples/... diff --git a/bazel/docker/ubuntu/Dockerfile b/bazel/docker/ubuntu/Dockerfile index 83fbe80f51..0328ded524 100644 --- a/bazel/docker/ubuntu/Dockerfile +++ b/bazel/docker/ubuntu/Dockerfile @@ -15,16 +15,12 @@ RUN apt update -qq \ && apt clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -# Install Bazel -RUN apt install -y apt-transport-https curl gnupg \ -&& curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg \ -&& mv bazel-archive-keyring.gpg /usr/share/keyrings +# Install Bazelisk ARG TARGETARCH=amd64 -RUN echo "deb [arch=$TARGETARCH signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list -RUN apt update -qq \ -&& apt install -yq bazel \ -&& apt clean \ -&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN wget \ +https://github.com/bazelbuild/bazelisk/releases/download/v1.27.0/bazelisk-linux-${TARGETARCH} \ +&& chmod +x bazelisk-linux-${TARGETARCH} \ +&& mv bazelisk-linux-${TARGETARCH} /usr/local/bin/bazel FROM env AS devel WORKDIR /home/project @@ -32,13 +28,7 @@ COPY . . FROM devel AS build RUN bazel version -RUN bazel build \ - -c opt \ - --subcommands=true \ - //ortools/... //examples/... +RUN bazel build --config=ci //ortools/... //examples/... FROM build AS test -RUN bazel test \ - -c opt \ - --test_output=errors \ - //ortools/... //examples/... +RUN bazel test --config=ci //ortools/... //examples/...