-
-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes issue with arm64 support. (#404)
* Addresses issue [#390](#391) by adding support for multi-architecture container images. * Removed --platform due to linting rule constraints. * Removed echo statements due to lint rules. Signed-off-by: Michael Primeaux <[email protected]>
- Loading branch information
Showing
2 changed files
with
20 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
# Build the manager binary | ||
ARG ARCH="amd64" | ||
FROM golang:1.17 as builder | ||
ARG BUILDOS | ||
ARG BUILDPLATFORM | ||
ARG BUILDARCH | ||
ARG BUILDVARIANT | ||
ARG TARGETPLATFORM | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
|
||
WORKDIR /workspace | ||
# Copy the Go Modules manifests | ||
|
@@ -17,11 +24,16 @@ COPY controllers/ controllers/ | |
COPY k8sutils/ k8sutils/ | ||
|
||
# Build | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} GO111MODULE=on go build -a -o manager main.go | ||
ARG LDFLAGS="-s -w" | ||
ENV GOOS=$TARGETOS | ||
ENV GOARCH=$TARGETARCH | ||
ENV CGO_ENABLED=0 | ||
|
||
RUN GO111MODULE=on go build -ldflags "${LDFLAGS}" -a -o manager main.go | ||
|
||
# Use distroless as minimal base image to package the manager binary | ||
# Refer to https://github.com/GoogleContainerTools/distroless for more details | ||
FROM gcr.io/distroless/static:nonroot-${ARCH} | ||
FROM gcr.io/distroless/static:nonroot | ||
LABEL maintainer="The Opstree Opensource <[email protected]>" | ||
WORKDIR / | ||
COPY --from=builder /workspace/manager . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters