Skip to content

Commit 900a674

Browse files
TomerFidmjb
andauthored
fix: ubi image build should support multi arch builds (#2655)
Signed-off-by: Tomer Figenblat <[email protected]> Co-authored-by: Don Browne <[email protected]>
1 parent 6d56f1c commit 900a674

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

cmd/thv-operator/Taskfile.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,11 @@ tasks:
364364
SHA:
365365
sh: git rev-parse HEAD || echo "unknown"
366366
REPO: '{{.REPO | default "ghcr.io/stacklok/toolhive"}}'
367+
PLATFORM:
368+
sh: echo "${PLATFORM:-linux/$(go env GOARCH)}"
367369
cmds:
368370
- >
369-
eval "{{.CONTAINER_RUNTIME}} build --load
371+
eval "{{.CONTAINER_RUNTIME}} build --platform={{.PLATFORM}} --load
370372
-t {{.REPO}}/thv-operator:{{.SHA}}-ubi
371373
--build-arg CODEDIR=cmd/thv-operator
372374
--build-arg VERSION={{.SHA}}-ubi
@@ -386,9 +388,11 @@ tasks:
386388
SHA:
387389
sh: git rev-parse HEAD || echo "unknown"
388390
REPO: '{{.REPO | default "ghcr.io/stacklok/toolhive"}}'
391+
PLATFORM:
392+
sh: echo "${PLATFORM:-linux/$(go env GOARCH)}"
389393
cmds:
390394
- >
391-
eval "{{.CONTAINER_RUNTIME}} build --load
395+
eval "{{.CONTAINER_RUNTIME}} build --platform={{.PLATFORM}} --load
392396
-t {{.REPO}}/thv-proxyrunner:{{.SHA}}-ubi
393397
--build-arg CODEDIR=cmd/thv-proxyrunner
394398
--build-arg VERSION={{.SHA}}-ubi

containers/operator/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ RUN CGO_ENABLED=0 LDFLAGS="-s -w \
2626
-X github.com/stacklok/toolhive/pkg/versions.Commit=${COMMIT} \
2727
-X github.com/stacklok/toolhive/pkg/versions.BuildDate=${BUILD_DATE} \
2828
-X github.com/stacklok/toolhive/pkg/versions.BuildType=release" \
29-
GOOS=linux GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o main ./${CODEDIR}/main.go
29+
go build -ldflags "${LDFLAGS}" -o main ./${CODEDIR}/main.go
3030

31-
# Use micro base image to package the binary
32-
FROM --platform=linux/amd64 registry.access.redhat.com/ubi10/ubi-minimal:10.1-1763362715
31+
# Use minimal base image to package the binary
32+
FROM registry.access.redhat.com/ubi10/ubi-minimal:10.1-1763362715
3333

3434
COPY --from=builder /workspace/main /
3535
COPY LICENSE /licenses/LICENSE

0 commit comments

Comments
 (0)