Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-platform kubestr image #316

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
- name: Build and push Docker image
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
with:
platforms: linux/amd64,linux/arm64,linux/ppc64le
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
Expand Down
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
FROM golang:1.22-bullseye AS builder
FROM golang:1.22-bookworm AS builder

ARG TARGETOS
ARG TARGETARCH

ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64 \
GOOS=${TARGETOS} \
GOARCH=${TARGETARCH} \
GOBIN=/dist

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means it's using emulation to compile for non-native targets.

Perhaps we should consider using FROM --platform=$BUILDPLATFORM golang:… and changing go install … to go build -o <OUTPUT_BIN> … so that it can use the native build platform and cross-compile (which is much faster and isn't prone to emulation errors).

If so, it may be good to change FROM alpine:… below to include --platform=$TARGETPLATFORM, just to be explicit and clear about which platform is being used where.

WORKDIR /app
Expand Down
Loading