Skip to content

Commit 1d77fa4

Browse files
committed
feat: add multi-platform docker builds
1 parent 0012443 commit 1d77fa4

14 files changed

Lines changed: 286 additions & 74 deletions

File tree

.github/workflows/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ jobs:
3737
username: ${{ secrets.DOCKER_USER }}
3838
password: ${{ secrets.DOCKER_PASSWORD }}
3939

40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v3
42+
4043
- name: Set up GO 1.25.8
4144
uses: actions/setup-go@v5
4245
with:
@@ -71,6 +74,7 @@ jobs:
7174
VERSION: ${{ github.event.release.tag_name }}
7275
IMAGE_TAG_BASE: streamnative/function-mesh
7376
CATALOG_BRANCH_TAG: latest
77+
PLATFORMS: linux/amd64,linux/arm64
7478
run: |
7579
# convert vx.y.z to x.y.z because a valid semver is needed in creating the bundle
7680
VERSION=$(echo $VERSION|cut -c 2-)

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Build the manager binary
2-
FROM golang:1.25.8-trixie AS builder
2+
FROM --platform=$BUILDPLATFORM golang:1.25.8-trixie AS builder
3+
4+
ARG TARGETOS
5+
ARG TARGETARCH
36

47
WORKDIR /workspace/api
58
COPY api/ .
@@ -20,7 +23,7 @@ COPY controllers/ controllers/
2023
COPY utils/ utils/
2124

2225
# Build
23-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
26+
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} GO111MODULE=on go build -a -o manager main.go
2427

2528
# Use distroless as minimal base image to package the manager binary
2629
# Refer to https://github.com/GoogleContainerTools/distroless for more details

Makefile

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ GOARCH := $(if $(GOARCH),$(GOARCH),amd64)
2222
GOENV := CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH)
2323
GO := $(GOENV) go
2424
GO_BUILD := $(GO) build -trimpath
25+
PLATFORMS ?= linux/amd64
26+
comma := ,
27+
PLATFORM_LIST := $(subst $(comma), ,$(PLATFORMS))
28+
PRIMARY_PLATFORM := $(word 1,$(PLATFORM_LIST))
29+
MULTI_PLATFORM_BUILD := $(if $(filter 1,$(words $(PLATFORM_LIST))),false,true)
30+
IMAGE_BUILD_PUSH ?= $(MULTI_PLATFORM_BUILD)
2531
GO_MAJOR_VERSION := $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1)
2632
GO_MINOR_VERSION := $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2)
2733

@@ -133,15 +139,27 @@ generate: controller-gen
133139

134140
# Build the docker image
135141
docker-build: test
136-
docker build --platform linux/amd64 . -t ${IMG}
142+
ifeq ($(MULTI_PLATFORM_BUILD),true)
143+
docker buildx build --platform $(PLATFORMS) --push -t ${IMG} .
144+
else
145+
docker build --platform $(PRIMARY_PLATFORM) -t ${IMG} .
146+
endif
137147

138148
# Build image for red hat certification
139149
docker-build-redhat:
140-
docker build --platform linux/amd64 -f redhat.Dockerfile . -t ${IMG} --build-arg VERSION=${VERSION} --no-cache
150+
ifeq ($(MULTI_PLATFORM_BUILD),true)
151+
docker buildx build --platform $(PLATFORMS) --push -f redhat.Dockerfile -t ${IMG} --build-arg VERSION=${VERSION} --no-cache .
152+
else
153+
docker build --platform $(PRIMARY_PLATFORM) -f redhat.Dockerfile -t ${IMG} --build-arg VERSION=${VERSION} --no-cache .
154+
endif
141155

142156
# Push the docker image
143157
image-push:
158+
ifeq ($(IMAGE_BUILD_PUSH),true)
159+
@echo "image already pushed during multi-platform build: ${IMG}"
160+
else
144161
docker push ${IMG}
162+
endif
145163

146164
# find or download controller-gen
147165
# download controller-gen if necessary
@@ -171,12 +189,12 @@ bundle: yq kustomize manifests
171189
# Build the bundle image.
172190
.PHONY: bundle-build
173191
bundle-build:
174-
docker build --platform linux/amd64 -f bundle.Dockerfile -t $(BUNDLE_IMG) .
192+
docker build --platform $(PRIMARY_PLATFORM) -f bundle.Dockerfile -t $(BUNDLE_IMG) .
175193

176194
.PHONY: bundle-push
177195
bundle-push: ## Push the bundle image.
178196
echo $(BUNDLE_IMG)
179-
$(MAKE) image-push IMG=$(BUNDLE_IMG)
197+
$(MAKE) image-push IMG=$(BUNDLE_IMG) IMAGE_BUILD_PUSH=false
180198

181199
crd: manifests
182200
$(KUSTOMIZE) build config/crd > manifests/crd.yaml
@@ -187,12 +205,20 @@ rbac: manifests
187205
release: manifests kustomize crd rbac manager operator-docker-image helm-crds
188206

189207
operator-docker-image: manager test
190-
docker build --platform linux/amd64 -f operator.Dockerfile -t $(OPERATOR_IMG) .
208+
ifeq ($(MULTI_PLATFORM_BUILD),true)
209+
docker buildx build --platform $(PLATFORMS) --push -f operator.Dockerfile -t $(OPERATOR_IMG) -t $(OPERATOR_IMG_LATEST) .
210+
else
211+
docker build --platform $(PRIMARY_PLATFORM) -f operator.Dockerfile -t $(OPERATOR_IMG) .
191212
docker tag $(OPERATOR_IMG) $(OPERATOR_IMG_LATEST)
213+
endif
192214

193215
docker-push:
216+
ifeq ($(MULTI_PLATFORM_BUILD),true)
217+
@echo "operator images already pushed during multi-platform build: $(OPERATOR_IMG), $(OPERATOR_IMG_LATEST)"
218+
else
194219
docker push $(OPERATOR_IMG)
195220
docker push $(OPERATOR_IMG_LATEST)
221+
endif
196222

197223
.PHONY: opm
198224
OPM = ./bin/opm
@@ -240,9 +266,9 @@ endif
240266
# Push the catalog image.
241267
.PHONY: catalog-push
242268
catalog-push: ## Push a catalog image.
243-
$(MAKE) image-push IMG=$(CATALOG_IMG)
269+
$(MAKE) image-push IMG=$(CATALOG_IMG) IMAGE_BUILD_PUSH=false
244270
ifneq ($(origin CATALOG_BRANCH_TAG), undefined)
245-
$(MAKE) image-push IMG=$(CATALOG_BRANCH_IMG)
271+
$(MAKE) image-push IMG=$(CATALOG_BRANCH_IMG) IMAGE_BUILD_PUSH=false
246272
endif
247273

248274
version:
@@ -256,7 +282,11 @@ function-mesh-docker-image-name:
256282

257283
# Build the docker image without tests
258284
docker-build-skip-test:
259-
docker build --platform linux/amd64 . -t ${IMG}
285+
ifeq ($(MULTI_PLATFORM_BUILD),true)
286+
docker buildx build --platform $(PLATFORMS) --push -t ${IMG} .
287+
else
288+
docker build --platform $(PRIMARY_PLATFORM) -t ${IMG} .
289+
endif
260290

261291
e2e: skywalking-e2e yq
262292
$(E2E) run -c .ci/tests/integration/e2e.yaml
@@ -297,17 +327,21 @@ redhat-certificated-bundle: yq kustomize manifests
297327
# Build the bundle image.
298328
.PHONY: redhat-certificated-bundle-build
299329
redhat-certificated-bundle-build:
300-
docker build --platform linux/amd64 -f bundle.Dockerfile -t $(BUNDLE_IMG) .
330+
docker build --platform $(PRIMARY_PLATFORM) -f bundle.Dockerfile -t $(BUNDLE_IMG) .
301331

302332
.PHONY: redhat-certificated-bundle-push
303333
redhat-certificated-bundle-push: ## Push the bundle image.
304334
echo $(BUNDLE_IMG)
305-
$(MAKE) image-push IMG=$(BUNDLE_IMG)
335+
$(MAKE) image-push IMG=$(BUNDLE_IMG) IMAGE_BUILD_PUSH=false
306336

307337
# Build the bundle image.
308338
.PHONY: redhat-certificated-image-build
309339
redhat-certificated-image-build:
310-
docker build --platform linux/amd64 -f redhat.Dockerfile . -t ${OPERATOR_IMG} --build-arg VERSION=${VERSION} --no-cache
340+
ifeq ($(MULTI_PLATFORM_BUILD),true)
341+
docker buildx build --platform $(PLATFORMS) --push -f redhat.Dockerfile -t ${OPERATOR_IMG} --build-arg VERSION=${VERSION} --no-cache .
342+
else
343+
docker build --platform $(PRIMARY_PLATFORM) -f redhat.Dockerfile -t ${OPERATOR_IMG} --build-arg VERSION=${VERSION} --no-cache .
344+
endif
311345

312346
.PHONY: redhat-certificated-image-push
313347
redhat-certificated-image-push: ## Push the bundle image.

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,18 @@ operator-sdk create api --group compute --version v1alpha1 --kind Function --res
6262
operator-sdk create webhook --group compute.functionmesh.io --version v1alpha1 --kind Function --defaulting --programmatic-validation
6363
```
6464

65+
### Multi-platform images
66+
67+
The image build targets accept `PLATFORMS` as a comma-separated Docker platform list.
68+
69+
```bash
70+
make docker-build PLATFORMS=linux/amd64,linux/arm64
71+
make operator-docker-image PLATFORMS=linux/amd64,linux/arm64
72+
PLATFORMS=linux/amd64,linux/arm64 PUSH=true images/build.sh
73+
```
74+
75+
Single-platform builds still default to `linux/amd64`. Multi-platform builds use `docker buildx` and push a manifest list directly, so they require an authenticated registry session.
76+
6577
## Deployment
6678

6779
1. make sure connected to a kubernetes cluster(gke, mini-kube etc.)

docs/release_proocess.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ git push origin vX.Y.Z
3030
3. Click the release button
3131

3232
Click the release button and draft a new release. When publish the release, the Action CI will automatically trigger the release process, build the corresponding image, and push it to docker_hub.
33+
34+
The release workflow publishes multi-platform Docker images for `linux/amd64` and `linux/arm64`.

images/build.sh

Lines changed: 98 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# specific language governing permissions and limitations
1818
# under the License.
1919
#
20-
set -e
20+
set -euo pipefail
2121

2222
PULSAR_IMAGE=${PULSAR_IMAGE:-"streamnative/sn-platform"}
2323
PULSAR_IMAGE_TAG=${PULSAR_IMAGE_TAG:-"2.7.1"}
@@ -34,53 +34,120 @@ PULSARCTL_PYTHON_RUNNER="pulsar-functions-pulsarctl-python-runner"
3434
RUNNER_TAG=${RUNNER_TAG:-$PULSAR_IMAGE_TAG}
3535
KIND_PUSH=${KIND_PUSH:-false}
3636
CI_TEST=${CI_TEST:-false}
37+
PLATFORMS=${PLATFORMS:-"linux/amd64"}
38+
PRIMARY_PLATFORM=${PLATFORMS%%,*}
39+
RUNNER_BASE_IMAGE="${DOCKER_REPO}/${RUNNER_BASE}:${RUNNER_TAG}"
40+
PULSARCTL_RUNNER_BASE_IMAGE="${DOCKER_REPO}/${PULSARCTL_RUNNER_BASE}:${RUNNER_TAG}"
41+
JAVA_RUNNER_IMAGE="${DOCKER_REPO}/${JAVA_RUNNER}:${RUNNER_TAG}"
42+
PULSARCTL_JAVA_RUNNER_IMAGE="${DOCKER_REPO}/${PULSARCTL_JAVA_RUNNER}:${RUNNER_TAG}"
43+
GO_RUNNER_IMAGE="${DOCKER_REPO}/${GO_RUNNER}:${RUNNER_TAG}"
44+
PULSARCTL_GO_RUNNER_IMAGE="${DOCKER_REPO}/${PULSARCTL_GO_RUNNER}:${RUNNER_TAG}"
45+
PYTHON_RUNNER_IMAGE="${DOCKER_REPO}/${PYTHON_RUNNER}:${RUNNER_TAG}"
46+
PULSARCTL_PYTHON_RUNNER_IMAGE="${DOCKER_REPO}/${PULSARCTL_PYTHON_RUNNER}:${RUNNER_TAG}"
47+
48+
MULTI_PLATFORM=false
49+
if [[ "${PLATFORMS}" == *,* ]]; then
50+
MULTI_PLATFORM=true
51+
fi
52+
53+
PUSH_DEFAULT=false
54+
if [[ "${DOCKER_REPO}" == "localhost:5000" || "${MULTI_PLATFORM}" == "true" ]]; then
55+
PUSH_DEFAULT=true
56+
fi
57+
PUSH=${PUSH:-$PUSH_DEFAULT}
58+
59+
if [[ "${MULTI_PLATFORM}" == "true" && "${PUSH}" != "true" ]]; then
60+
echo "multi-platform builds require PUSH=true so dependent images can resolve their base images" >&2
61+
exit 1
62+
fi
63+
64+
if [[ "${MULTI_PLATFORM}" == "true" && "${KIND_PUSH}" == "true" ]]; then
65+
echo "KIND_PUSH=true is only supported for single-platform builds" >&2
66+
exit 1
67+
fi
68+
69+
build_image() {
70+
local image=$1
71+
local context=$2
72+
shift 2
73+
74+
if [[ "${MULTI_PLATFORM}" == "true" ]]; then
75+
docker buildx build --platform "${PLATFORMS}" --push -t "${image}" "$@" "${context}"
76+
else
77+
docker build --platform "${PRIMARY_PLATFORM}" -t "${image}" "$@" "${context}"
78+
fi
79+
}
3780

3881
echo "build runner base"
39-
docker build --platform linux/amd64 -t ${RUNNER_BASE} images/pulsar-functions-base-runner --build-arg PULSAR_IMAGE="$PULSAR_IMAGE" --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG" --progress=plain
40-
docker build --platform linux/amd64 -t ${PULSARCTL_RUNNER_BASE} images/pulsar-functions-base-runner -f images/pulsar-functions-base-runner/pulsarctl.Dockerfile --build-arg PULSAR_IMAGE="$PULSAR_IMAGE" --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG" --progress=plain
41-
docker tag ${RUNNER_BASE} "${DOCKER_REPO}"/${RUNNER_BASE}:"${RUNNER_TAG}"
42-
docker tag ${PULSARCTL_RUNNER_BASE} "${DOCKER_REPO}"/${PULSARCTL_RUNNER_BASE}:"${RUNNER_TAG}"
82+
build_image "${RUNNER_BASE_IMAGE}" images/pulsar-functions-base-runner \
83+
--build-arg PULSAR_IMAGE="${PULSAR_IMAGE}" \
84+
--build-arg PULSAR_IMAGE_TAG="${PULSAR_IMAGE_TAG}" \
85+
--progress=plain
86+
build_image "${PULSARCTL_RUNNER_BASE_IMAGE}" images/pulsar-functions-base-runner \
87+
-f images/pulsar-functions-base-runner/pulsarctl.Dockerfile \
88+
--build-arg PULSAR_IMAGE="${PULSAR_IMAGE}" \
89+
--build-arg PULSAR_IMAGE_TAG="${PULSAR_IMAGE_TAG}" \
90+
--progress=plain
4391

4492
echo "build java runner"
45-
docker build --platform linux/amd64 -t ${JAVA_RUNNER} images/pulsar-functions-java-runner --build-arg PULSAR_IMAGE="$PULSAR_IMAGE" --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG" --progress=plain
46-
docker build --platform linux/amd64 -t ${PULSARCTL_JAVA_RUNNER} images/pulsar-functions-java-runner -f images/pulsar-functions-java-runner/pulsarctl.Dockerfile --build-arg PULSAR_IMAGE="$PULSAR_IMAGE" --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG" --progress=plain
47-
docker tag ${JAVA_RUNNER} "${DOCKER_REPO}"/${JAVA_RUNNER}:"${RUNNER_TAG}"
48-
docker tag ${PULSARCTL_JAVA_RUNNER} "${DOCKER_REPO}"/${PULSARCTL_JAVA_RUNNER}:"${RUNNER_TAG}"
93+
build_image "${JAVA_RUNNER_IMAGE}" images/pulsar-functions-java-runner \
94+
--build-arg BASE_IMAGE="${RUNNER_BASE_IMAGE}" \
95+
--build-arg PULSAR_IMAGE="${PULSAR_IMAGE}" \
96+
--build-arg PULSAR_IMAGE_TAG="${PULSAR_IMAGE_TAG}" \
97+
--progress=plain
98+
build_image "${PULSARCTL_JAVA_RUNNER_IMAGE}" images/pulsar-functions-java-runner \
99+
-f images/pulsar-functions-java-runner/pulsarctl.Dockerfile \
100+
--build-arg BASE_IMAGE="${PULSARCTL_RUNNER_BASE_IMAGE}" \
101+
--build-arg PULSAR_IMAGE="${PULSAR_IMAGE}" \
102+
--build-arg PULSAR_IMAGE_TAG="${PULSAR_IMAGE_TAG}" \
103+
--progress=plain
49104

50105
echo "build python runner"
51-
docker build --platform linux/amd64 -t ${PYTHON_RUNNER} images/pulsar-functions-python-runner --build-arg PULSAR_IMAGE="$PULSAR_IMAGE" --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG" --progress=plain
52-
docker build --platform linux/amd64 -t ${PULSARCTL_PYTHON_RUNNER} images/pulsar-functions-python-runner -f images/pulsar-functions-python-runner/pulsarctl.Dockerfile --build-arg PULSAR_IMAGE="$PULSAR_IMAGE" --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG" --build-arg PYTHON_VERSION="$PYTHON_VERSION" --progress=plain
53-
docker tag ${PYTHON_RUNNER} "${DOCKER_REPO}"/${PYTHON_RUNNER}:"${RUNNER_TAG}"
54-
docker tag ${PULSARCTL_PYTHON_RUNNER} "${DOCKER_REPO}"/${PULSARCTL_PYTHON_RUNNER}:"${RUNNER_TAG}"
106+
build_image "${PYTHON_RUNNER_IMAGE}" images/pulsar-functions-python-runner \
107+
--build-arg BASE_IMAGE="${RUNNER_BASE_IMAGE}" \
108+
--build-arg PULSAR_IMAGE="${PULSAR_IMAGE}" \
109+
--build-arg PULSAR_IMAGE_TAG="${PULSAR_IMAGE_TAG}" \
110+
--progress=plain
111+
build_image "${PULSARCTL_PYTHON_RUNNER_IMAGE}" images/pulsar-functions-python-runner \
112+
-f images/pulsar-functions-python-runner/pulsarctl.Dockerfile \
113+
--build-arg PULSAR_IMAGE="${PULSAR_IMAGE}" \
114+
--build-arg PULSAR_IMAGE_TAG="${PULSAR_IMAGE_TAG}" \
115+
--build-arg PYTHON_VERSION="${PYTHON_VERSION}" \
116+
--progress=plain
55117

56118
echo "build go runner"
57-
docker build --platform linux/amd64 -t ${GO_RUNNER} images/pulsar-functions-go-runner --progress=plain # go runner is almost the same as runner base, so we no need to given build args for go runner
58-
docker build --platform linux/amd64 -t ${PULSARCTL_GO_RUNNER} images/pulsar-functions-go-runner -f images/pulsar-functions-go-runner/pulsarctl.Dockerfile --progress=plain # go runner is almost the same as runner base, so we no need to given build args for go runner
59-
docker tag ${GO_RUNNER} "${DOCKER_REPO}"/${GO_RUNNER}:"${RUNNER_TAG}"
60-
docker tag ${PULSARCTL_GO_RUNNER} "${DOCKER_REPO}"/${PULSARCTL_GO_RUNNER}:"${RUNNER_TAG}"
119+
build_image "${GO_RUNNER_IMAGE}" images/pulsar-functions-go-runner \
120+
--build-arg BASE_IMAGE="${RUNNER_BASE_IMAGE}" \
121+
--progress=plain
122+
build_image "${PULSARCTL_GO_RUNNER_IMAGE}" images/pulsar-functions-go-runner \
123+
-f images/pulsar-functions-go-runner/pulsarctl.Dockerfile \
124+
--build-arg BASE_IMAGE="${PULSARCTL_RUNNER_BASE_IMAGE}" \
125+
--progress=plain
61126

62127
if [ "$KIND_PUSH" = true ] ; then
63128
echo "push images to kind"
64129
clusters=$(kind get clusters)
65130
echo $clusters
66131
for cluster in $clusters
67132
do
68-
kind load docker-image "${DOCKER_REPO}"/${JAVA_RUNNER}:"${RUNNER_TAG}" --name $cluster
69-
kind load docker-image "${DOCKER_REPO}"/${PULSARCTL_JAVA_RUNNER}:"${RUNNER_TAG}" --name $cluster
70-
kind load docker-image "${DOCKER_REPO}"/${PYTHON_RUNNER}:"${RUNNER_TAG}" --name $cluster
71-
kind load docker-image "${DOCKER_REPO}"/${PULSARCTL_PYTHON_RUNNER}:"${RUNNER_TAG}" --name $cluster
72-
kind load docker-image "${DOCKER_REPO}"/${GO_RUNNER}:"${RUNNER_TAG}" --name $cluster
73-
kind load docker-image "${DOCKER_REPO}"/${PULSARCTL_GO_RUNNER}:"${RUNNER_TAG}" --name $cluster
133+
kind load docker-image "${JAVA_RUNNER_IMAGE}" --name $cluster
134+
kind load docker-image "${PULSARCTL_JAVA_RUNNER_IMAGE}" --name $cluster
135+
kind load docker-image "${PYTHON_RUNNER_IMAGE}" --name $cluster
136+
kind load docker-image "${PULSARCTL_PYTHON_RUNNER_IMAGE}" --name $cluster
137+
kind load docker-image "${GO_RUNNER_IMAGE}" --name $cluster
138+
kind load docker-image "${PULSARCTL_GO_RUNNER_IMAGE}" --name $cluster
74139
done
75140
fi
76141

77-
if [ "$DOCKER_REPO" = "localhost:5000" ]; then
78-
docker push "${DOCKER_REPO}"/${JAVA_RUNNER}:"${RUNNER_TAG}"
79-
docker push "${DOCKER_REPO}"/${PULSARCTL_JAVA_RUNNER}:"${RUNNER_TAG}"
80-
docker push "${DOCKER_REPO}"/${PYTHON_RUNNER}:"${RUNNER_TAG}"
81-
docker push "${DOCKER_REPO}"/${PULSARCTL_PYTHON_RUNNER}:"${RUNNER_TAG}"
82-
docker push "${DOCKER_REPO}"/${GO_RUNNER}:"${RUNNER_TAG}"
83-
docker push "${DOCKER_REPO}"/${PULSARCTL_GO_RUNNER}:"${RUNNER_TAG}"
142+
if [[ "${PUSH}" == "true" && "${MULTI_PLATFORM}" != "true" ]]; then
143+
docker push "${RUNNER_BASE_IMAGE}"
144+
docker push "${PULSARCTL_RUNNER_BASE_IMAGE}"
145+
docker push "${JAVA_RUNNER_IMAGE}"
146+
docker push "${PULSARCTL_JAVA_RUNNER_IMAGE}"
147+
docker push "${PYTHON_RUNNER_IMAGE}"
148+
docker push "${PULSARCTL_PYTHON_RUNNER_IMAGE}"
149+
docker push "${GO_RUNNER_IMAGE}"
150+
docker push "${PULSARCTL_GO_RUNNER_IMAGE}"
84151
fi
85152
#
86153
#if [ "$CI_TEST" = true ] ; then
@@ -93,4 +160,4 @@ fi
93160
# kind load docker-image "${DOCKER_REPO}"/${PYTHON_RUNNER}:"${RUNNER_TAG}" --name $cluster
94161
# kind load docker-image "${DOCKER_REPO}"/${GO_RUNNER}:"${RUNNER_TAG}" --name $cluster
95162
# done
96-
#fi
163+
#fi

images/pulsar-functions-base-runner/pulsarctl.Dockerfile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
FROM alpine:3.21 as functions-runner
22

3+
ARG TARGETARCH
4+
35
ENV GID=10001
46
ENV UID=10000
57
ENV USER=pulsar
@@ -17,10 +19,15 @@ RUN mkdir -p /pulsar/bin/ \
1719
&& chown -R $UID:$GID /pulsar \
1820
&& chmod -R g=u /pulsar \
1921
&& apk update && apk add --no-cache wget bash \
20-
&& wget https://github.com/streamnative/pulsarctl/releases/latest/download/pulsarctl-amd64-linux.tar.gz -P /pulsar/bin/ \
21-
&& tar -xzf /pulsar/bin/pulsarctl-amd64-linux.tar.gz -C /pulsar/bin/ \
22-
&& rm -rf /pulsar/bin/pulsarctl-amd64-linux.tar.gz \
23-
&& chmod +x /pulsar/bin/pulsarctl-amd64-linux/pulsarctl \
24-
&& ln -s /pulsar/bin/pulsarctl-amd64-linux/pulsarctl /usr/local/bin/pulsarctl
22+
&& case "${TARGETARCH}" in \
23+
amd64|arm64) PULSARCTL_ARCH="${TARGETARCH}" ;; \
24+
*) echo "unsupported TARGETARCH: ${TARGETARCH}" && exit 1 ;; \
25+
esac \
26+
&& PULSARCTL_DIST="pulsarctl-${PULSARCTL_ARCH}-linux.tar.gz" \
27+
&& wget "https://github.com/streamnative/pulsarctl/releases/latest/download/${PULSARCTL_DIST}" -P /pulsar/bin/ \
28+
&& tar -xzf "/pulsar/bin/${PULSARCTL_DIST}" -C /pulsar/bin/ \
29+
&& rm -rf "/pulsar/bin/${PULSARCTL_DIST}" \
30+
&& chmod +x "/pulsar/bin/pulsarctl-${PULSARCTL_ARCH}-linux/pulsarctl" \
31+
&& ln -s "/pulsar/bin/pulsarctl-${PULSARCTL_ARCH}-linux/pulsarctl" /usr/local/bin/pulsarctl
2532

2633
WORKDIR /pulsar

images/pulsar-functions-go-runner/pulsarctl.Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM pulsar-functions-pulsarctl-runner-base:latest
1+
ARG BASE_IMAGE=pulsar-functions-pulsarctl-runner-base:latest
2+
3+
FROM ${BASE_IMAGE}
24

35
WORKDIR /pulsar
46

0 commit comments

Comments
 (0)