Skip to content

Commit

Permalink
fix: fix arm64 build
Browse files Browse the repository at this point in the history
  • Loading branch information
this-is-tobi committed Sep 3, 2023
1 parent 51ca1a9 commit 9cf7d31
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
with:
version: v0.7.1

- name: Set up QEMU (for multi platform build)
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0

- name: ci/docker-login
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
with:
Expand Down
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ ARG BASE_IMAGE=gcr.io/distroless/static:nonroot

FROM ${BUILD_IMAGE} as builder

ARG TARGETARCH
ARG TARGETOS

WORKDIR /workspace
COPY . .

RUN mkdir -p licenses
COPY LICENSE /workspace/licenses

# Build
RUN make build
RUN make build TARGET_OS=$TARGETOS TARGET_ARCH=$TARGETARCH

FROM ${BASE_IMAGE}

Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ MACHINE = $(shell uname -m)
GOFLAGS ?= $(GOFLAGS:) -mod=vendor
BUILD_TIME := $(shell date -u +%Y%m%d.%H%M%S)
BUILD_HASH := $(shell git rev-parse HEAD)
TARGET_OS ?= linux
TARGET_ARCH ?= amd64

BUNDLE_IMG ?= controller-bundle:$(VERSION) # Default bundle image tag
CRD_OPTIONS ?= "crd" # Image URL to use all building/pushing image targets
Expand Down Expand Up @@ -119,7 +121,7 @@ goverall: $(GOVERALLS_GEN) ## Runs goveralls

build: ## Build the mattermost-operator
@echo Building Mattermost-operator
GO111MODULE=on GOOS=linux GOARCH=amd64 CGO_ENABLED=0 $(GO) build $(GOFLAGS) -gcflags all=-trimpath=$(GOPATH) -asmflags all=-trimpath=$(GOPATH) -a -installsuffix cgo -o build/_output/bin/mattermost-operator $(GO_LINKER_FLAGS) ./main.go
GO111MODULE=on GOOS=$(TARGET_OS) GOARCH=$(TARGET_ARCH) CGO_ENABLED=0 $(GO) build $(GOFLAGS) -gcflags all=-trimpath=$(GOPATH) -asmflags all=-trimpath=$(GOPATH) -a -installsuffix cgo -o build/_output/bin/mattermost-operator $(GO_LINKER_FLAGS) ./main.go

.PHONE: buildx-image
buildx-image: ## Builds and pushes the docker image for mattermost-operator
Expand Down

0 comments on commit 9cf7d31

Please sign in to comment.