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

Conversation

bathina2
Copy link
Contributor

@bathina2 bathina2 commented Dec 2, 2024

This PR creates a multi-platform kubestr image.

@bathina2 bathina2 requested review from mabhi and julio-lopez December 2, 2024 20:16
Dockerfile Outdated
Comment on lines 1 to 10
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.

@bathina2 bathina2 force-pushed the bathina2/multi-platform-image branch from e18c163 to f07da37 Compare December 2, 2024 21:55
Copy link
Member

@miquella miquella left a comment

Choose a reason for hiding this comment

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

LGTM

@bathina2 bathina2 merged commit dc40661 into master Dec 3, 2024
4 checks passed
@bathina2 bathina2 deleted the bathina2/multi-platform-image branch December 3, 2024 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants