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

Respect docker platform by removing GOARCH fromgo build #155

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
4 changes: 2 additions & 2 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{env.DOCKER_REGISTRY}}/${{env.DOCKER_REPOSITORY}}:${{github.sha}}-${{matrix.arch}}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: type=gha,mode=max,scope=${{matrix.arch}}
platforms: linux/${{matrix.arch}}
- name: Retag sha as ref_name and push built image
run: |
Expand Down Expand Up @@ -81,4 +81,4 @@ jobs:
docker manifest create --amend ${{env.DOCKER_REGISTRY}}/${{env.DOCKER_REPOSITORY}}:latest ${{env.DOCKER_REGISTRY}}/${{env.DOCKER_REPOSITORY}}:${{github.sha}}-$arch
done
docker manifest push ${{env.DOCKER_REGISTRY}}/${{env.DOCKER_REPOSITORY}}:latest
docker manifest inspect ${{env.DOCKER_REGISTRY}}/${{env.DOCKER_REPOSITORY}}:latest
docker manifest inspect ${{env.DOCKER_REGISTRY}}/${{env.DOCKER_REPOSITORY}}:latest
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ COPY api/ api/
COPY controllers/ controllers/

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 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
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ run: manifests generate fmt vet ## Run a controller from your host.
go run ./main.go

.PHONY: docker-build
DOCKER_BUILD_ARGS ?= --platform=linux/amd64
docker-build: test ## Build docker image with the manager.
docker build -t ${IMG} .
docker build -t $(IMG) . $(DOCKER_BUILD_ARGS)

.PHONY: docker-push
docker-push: ## Push docker image with the manager.
Expand Down