Skip to content

Commit 63076c1

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 63076c1

File tree

6 files changed

+232
-76
lines changed

6 files changed

+232
-76
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

bazel/external/Dockerfile.amd64

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# syntax=docker/dockerfile:1
2+
# Copyright 2025 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Prep:
17+
# docker run --rm --privileged tonistiigi/binfmt --install all
18+
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
19+
# Need to see "F" flag: cat /proc/sys/fs/binfmt_misc/qemu-*
20+
#
21+
# Build:
22+
# docker buildx build --platform linux/amd64 -t $IMAGE -f Dockerfile.amd64
23+
#
24+
# Push:
25+
# docker image tag $IMAGE ghcr.io/proxy-wasm/$IMAGE
26+
# docker push ghcr.io/proxy-wasm/$IMAGE
27+
#
28+
# Test:
29+
# docker run --rm --volume $(pwd):/mnt --workdir /mnt \
30+
# --platform linux/amd64 $IMAGE \
31+
# bazel test --verbose_failures --test_output=errors \
32+
# --define engine=null --config=clang --test_timeout=1800 \
33+
# -- //test/...
34+
35+
# Stage 1: main build image
36+
ARG UBUNTU_VERSION=24.04
37+
FROM ubuntu:${UBUNTU_VERSION} AS build
38+
39+
# Use bash for all RUN instructions
40+
SHELL ["/bin/bash", "-c"]
41+
42+
# Consolidated system update/upgrade and autoremove
43+
RUN apt-get update && \
44+
apt-get upgrade -y && \
45+
apt-get autoremove -y && \
46+
rm -rf /var/lib/apt/lists/*
47+
48+
## All build dependencies for Bazel and ProxyWasm are listed in DEPS for clarity and maintainability.
49+
ARG DEPS="\
50+
build-essential \
51+
clang \
52+
curl \
53+
git \
54+
libssl-dev \
55+
libstdc++6 \
56+
libz-dev \
57+
openjdk-21-jdk \
58+
python3 \
59+
unzip \
60+
zip\
61+
"
62+
# Install all build dependencies (no PPA needed on Ubuntu 24.04)
63+
RUN apt-get update && \
64+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $DEPS && \
65+
rm -rf /var/lib/apt/lists/*
66+
67+
# Install bazelisk: use binary for amd64
68+
ARG BAZELISK_VERSION=v1.27.0
69+
RUN ARCH=$(uname -m) && \
70+
curl -L -o /usr/local/bin/bazelisk "https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_VERSION}/bazelisk-linux-$ARCH" && \
71+
chmod +x /usr/local/bin/bazelisk && \
72+
ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel
73+
74+
# Set a valid working directory
75+
WORKDIR /root

bazel/external/Dockerfile.amd64-arm64

Whitespace-only changes.

bazel/external/Dockerfile.arm64

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# syntax=docker/dockerfile:1
2+
# Copyright 2025 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Prep:
17+
# docker run --rm --privileged tonistiigi/binfmt --install all
18+
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
19+
# Need to see "F" flag: cat /proc/sys/fs/binfmt_misc/qemu-*
20+
#
21+
# Build:
22+
# docker buildx build --platform linux/arm64 -t $IMAGE -f Dockerfile.arm64
23+
#
24+
# Push:
25+
# docker image tag $IMAGE ghcr.io/proxy-wasm/$IMAGE
26+
# docker push ghcr.io/proxy-wasm/$IMAGE
27+
#
28+
# Test:
29+
# docker run --rm --volume $(pwd):/mnt --workdir /mnt \
30+
# --platform linux/arm64 $IMAGE \
31+
# bazel test --verbose_failures --test_output=errors \
32+
# --define engine=null --config=clang --test_timeout=1800 \
33+
# -- //test/...
34+
35+
# Stage 1: main build image
36+
ARG UBUNTU_VERSION=24.04
37+
FROM ubuntu:${UBUNTU_VERSION} AS build
38+
39+
# Use bash for all RUN instructions
40+
SHELL ["/bin/bash", "-c"]
41+
42+
# Consolidated system update/upgrade and autoremove
43+
RUN apt-get update && \
44+
apt-get upgrade -y && \
45+
apt-get autoremove -y && \
46+
rm -rf /var/lib/apt/lists/*
47+
48+
## All build dependencies for Bazel and ProxyWasm are listed in DEPS for clarity and maintainability.
49+
ARG DEPS="\
50+
build-essential \
51+
clang \
52+
curl \
53+
git \
54+
libssl-dev \
55+
libstdc++6 \
56+
libz-dev \
57+
openjdk-21-jdk \
58+
python3 \
59+
unzip \
60+
zip\
61+
"
62+
# Install all build dependencies (no PPA needed on Ubuntu 24.04)
63+
RUN apt-get update && \
64+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $DEPS && \
65+
rm -rf /var/lib/apt/lists/*
66+
67+
# Install bazelisk: use binary for arm64
68+
ARG BAZELISK_VERSION=v1.27.0
69+
RUN ARCH=$(uname -m) && \
70+
curl -L -o /usr/local/bin/bazelisk "https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_VERSION}/bazelisk-linux-$ARCH" && \
71+
chmod +x /usr/local/bin/bazelisk && \
72+
ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel
73+
74+
# Set a valid working directory
75+
WORKDIR /root

bazel/external/Dockerfile.bazel

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +0,0 @@
1-
# syntax=docker/dockerfile:1
2-
# Copyright 2025 Google LLC
3-
#
4-
# Licensed under the Apache License, Version 2.0 (the "License");
5-
# you may not use this file except in compliance with the License.
6-
# You may obtain a copy of the License at
7-
#
8-
# http://www.apache.org/licenses/LICENSE-2.0
9-
#
10-
# Unless required by applicable law or agreed to in writing, software
11-
# distributed under the License is distributed on an "AS IS" BASIS,
12-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
# See the License for the specific language governing permissions and
14-
# limitations under the License.
15-
16-
17-
# Prep:
18-
# docker run --rm --privileged tonistiigi/binfmt --install all
19-
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
20-
# Need to see "F" flag: cat /proc/sys/fs/binfmt_misc/qemu-*
21-
#
22-
# Build:
23-
# docker buildx build --platform linux/s390x -t $IMAGE -f Dockerfile.bazel
24-
#
25-
# Push:
26-
# docker image tag $IMAGE ghcr.io/proxy-wasm/$IMAGE
27-
# docker push ghcr.io/proxy-wasm/$IMAGE
28-
#
29-
# Test:
30-
# docker run --rm --volume $(pwd):/mnt --workdir /mnt \
31-
# --platform linux/s390x $IMAGE \
32-
# bazel test --verbose_failures --test_output=errors \
33-
# --define engine=null --config=clang --test_timeout=1800 \
34-
# -- //test/...
35-
36-
# Update base image
37-
ARG UBUNTU_VERSION=24.04
38-
FROM ubuntu:${UBUNTU_VERSION} AS build
39-
40-
# Use bash for all RUN instructions
41-
SHELL ["/bin/bash", "-c"]
42-
43-
# Consolidated system update/upgrade and autoremove
44-
RUN apt-get update && \
45-
apt-get upgrade -y && \
46-
apt-get autoremove -y && \
47-
rm -rf /var/lib/apt/lists/*
48-
49-
## All build dependencies for Bazel and ProxyWasm are listed in DEPS for clarity and maintainability.
50-
ARG DEPS="\
51-
build-essential \
52-
clang \
53-
curl \
54-
git \
55-
libssl-dev \
56-
libstdc++6 \
57-
libz-dev \
58-
openjdk-21-jdk \
59-
python3 \
60-
unzip \
61-
zip\
62-
"
63-
# Install all build dependencies (no PPA needed on Ubuntu 24.04)
64-
RUN apt-get update && \
65-
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $DEPS && \
66-
rm -rf /var/lib/apt/lists/*
67-
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
73-
74-
# Set a valid working directory
75-
WORKDIR /root

bazel/external/Dockerfile.s390x

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# syntax=docker/dockerfile:1
2+
# Copyright 2025 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Prep:
17+
# docker run --rm --privileged tonistiigi/binfmt --install all
18+
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
19+
# Need to see "F" flag: cat /proc/sys/fs/binfmt_misc/qemu-*
20+
#
21+
# Build:
22+
# docker buildx build --platform linux/s390x -t $IMAGE -f Dockerfile.s390x
23+
#
24+
# Push:
25+
# docker image tag $IMAGE ghcr.io/proxy-wasm/$IMAGE
26+
# docker push ghcr.io/proxy-wasm/$IMAGE
27+
#
28+
# Test:
29+
# docker run --rm --volume $(pwd):/mnt --workdir /mnt \
30+
# --platform linux/s390x $IMAGE \
31+
# bazel test --verbose_failures --test_output=errors \
32+
# --define engine=null --config=clang --test_timeout=1800 \
33+
# -- //test/...
34+
35+
# Stage 1: builder for bazelisk on s390x
36+
ARG BAZELISK_VERSION=v1.27.0
37+
FROM golang:1.24-bullseye AS bazelisk-builder
38+
ARG BAZELISK_VERSION
39+
WORKDIR /src
40+
RUN git clone --branch ${BAZELISK_VERSION} --depth 1 https://github.com/bazelbuild/bazelisk.git bazelisk
41+
WORKDIR /src/bazelisk
42+
RUN go build -o /bazelisk .
43+
44+
# Stage 2: main build image
45+
ARG UBUNTU_VERSION=24.04
46+
FROM ubuntu:${UBUNTU_VERSION} AS build
47+
48+
# Use bash for all RUN instructions
49+
SHELL ["/bin/bash", "-c"]
50+
51+
# Consolidated system update/upgrade and autoremove
52+
RUN apt-get update && \
53+
apt-get upgrade -y && \
54+
apt-get autoremove -y && \
55+
rm -rf /var/lib/apt/lists/*
56+
57+
## All build dependencies for Bazel and ProxyWasm are listed in DEPS for clarity and maintainability.
58+
ARG DEPS="\
59+
build-essential \
60+
clang \
61+
curl \
62+
git \
63+
libssl-dev \
64+
libstdc++6 \
65+
libz-dev \
66+
openjdk-21-jdk \
67+
python3 \
68+
unzip \
69+
zip\
70+
"
71+
# Install all build dependencies (no PPA needed on Ubuntu 24.04)
72+
RUN apt-get update && \
73+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $DEPS && \
74+
rm -rf /var/lib/apt/lists/*
75+
76+
# Copy bazelisk from builder
77+
COPY --from=bazelisk-builder /bazelisk /usr/local/bin/bazelisk
78+
RUN ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel
79+
80+
# Set a valid working directory
81+
WORKDIR /root

0 commit comments

Comments
 (0)