bazel: rework docker ci

This commit is contained in:
Mizux Seiha
2025-09-16 15:54:33 +02:00
parent b51cd45ff4
commit f0330ec404
8 changed files with 42 additions and 93 deletions

View File

@@ -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/...

View File

@@ -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/...

View File

@@ -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/...

View File

@@ -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/...

View File

@@ -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/...

View File

@@ -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/...

View File

@@ -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/...

View File

@@ -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/...