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-Arch Image with arm64 #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.12.5 as builder
FROM golang:1.19.3 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand All @@ -14,13 +14,13 @@ COPY main.go main.go
COPY controllers/ controllers/

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
RUN CGO_ENABLED=0 GOOS=linux go build -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
WORKDIR /
COPY --from=builder /workspace/manager .
USER nonroot:nonroot
USER 65532:65532

ENTRYPOINT ["/manager"]
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ generate: controller-gen
./hack/generate-k8s-resources.sh

# Build the docker image
docker-build: test
docker build . -t ${IMG}
docker-build:
docker buildx build . --tag ${IMG} --platform linux/amd64,linux/arm64 --load

# Push the docker image
docker-push:
docker push ${IMG}
docker buildx build . --tag ${IMG} --platform linux/amd64,linux/arm64 --push

# find or download controller-gen
# download controller-gen if necessary
Expand Down