Skip to content

Commit 6b47f43

Browse files
committed
Add Dockerfiles for amd64, arm64, and s390x architectures; update build process
Signed-off-by: Matthieu MOREL <[email protected]>
1 parent da61281 commit 6b47f43

File tree

2 files changed

+38
-9
lines changed

2 files changed

+38
-9
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ jobs:
301301
302302
- name: Build local Docker image
303303
if: ${{ startsWith(matrix.run_under, 'docker') }}
304-
run: docker build --platform ${{ matrix.platform }} -f bazel/external/Dockerfile.bazel -t proxy-wasm/build-tools:local-ci .
304+
run: docker build --platform ${{ matrix.platform }} -f bazel/external/Dockerfile.s390x -t proxy-wasm/build-tools:local-ci .
305305

306306
- name: Bazel build/test
307307
shell: bash
Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
1716
# Prep:
1817
# docker run --rm --privileged tonistiigi/binfmt --install all
1918
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
2019
# Need to see "F" flag: cat /proc/sys/fs/binfmt_misc/qemu-*
2120
#
2221
# Build:
23-
# docker buildx build --platform linux/s390x -t $IMAGE -f Dockerfile.bazel
22+
# docker buildx build --platform linux/s390x -t $IMAGE -f Dockerfile.s390x
2423
#
2524
# Push:
2625
# docker image tag $IMAGE ghcr.io/proxy-wasm/$IMAGE
@@ -33,8 +32,40 @@
3332
# --define engine=null --config=clang --test_timeout=1800 \
3433
# -- //test/...
3534

36-
# Update base image
35+
ARG BAZELISK_VERSION=v1.27.0
3736
ARG UBUNTU_VERSION=24.04
37+
# Stage 1: builder for bazelisk on s390x
38+
FROM ubuntu:${UBUNTU_VERSION} AS bazelisk-builder
39+
SHELL ["/bin/bash", "-c"]
40+
WORKDIR /src
41+
ARG BAZELISK_VERSION
42+
ENV PATH="/usr/local/go/bin:$PATH"
43+
# Dépendances pour builder bazelisk
44+
ARG DEPS_BUILDER="\
45+
build-essential \
46+
ca-certificates \
47+
git \
48+
libc6-dev \
49+
pkg-config \
50+
tar \
51+
wget\
52+
"
53+
RUN apt-get update && \
54+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $DEPS_BUILDER && \
55+
wget --progress=dot:giga https://go.dev/dl/go1.24.0.linux-s390x.tar.gz && \
56+
tar -C /usr/local -xzf go1.24.0.linux-s390x.tar.gz && \
57+
rm go1.24.0.linux-s390x.tar.gz && \
58+
git clone --branch "$BAZELISK_VERSION" --single-branch --depth 1 https://github.com/bazelbuild/bazelisk.git bazelisk
59+
WORKDIR /src/bazelisk
60+
RUN go build -o /bazelisk .
61+
WORKDIR /src
62+
RUN rm -rf /src/bazelisk /src/.git /usr/local/go/pkg /usr/local/go/doc /usr/local/go/api /usr/local/go/test /usr/local/go/misc /usr/local/go/obj /usr/local/go/src && \
63+
apt-get remove --purge -y build-essential git wget && \
64+
apt-get autoremove -y && \
65+
apt-get clean && \
66+
rm -rf /var/lib/apt/lists/*
67+
68+
# Stage 2: main build image
3869
FROM ubuntu:${UBUNTU_VERSION} AS build
3970

4071
# Use bash for all RUN instructions
@@ -65,11 +96,9 @@ RUN apt-get update && \
6596
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $DEPS && \
6697
rm -rf /var/lib/apt/lists/*
6798

68-
# Install bazelisk and set Bazel version
69-
ARG BAZELISK_VERSION=v1.27.0
70-
RUN curl -L -o /usr/local/bin/bazelisk "https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_VERSION}/bazelisk-linux-$(uname -m)" \
71-
&& chmod +x /usr/local/bin/bazelisk \
72-
&& ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel
99+
# Copy bazelisk from builder
100+
COPY --from=bazelisk-builder /bazelisk /usr/local/bin/bazelisk
101+
RUN ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel
73102

74103
# Set a valid working directory
75104
WORKDIR /root

0 commit comments

Comments
 (0)