Skip to content

Commit

Permalink
fix: arm64 build targets
Browse files Browse the repository at this point in the history
The previous commit did not enable arm64 build correctly.

Signed-off-by: Noel Georgi <[email protected]>
  • Loading branch information
frezbo committed Oct 18, 2024
1 parent 0ae4409 commit 145d0a3
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
10 changes: 10 additions & 0 deletions .kres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ spec:
extraEnvironment:
PLATFORM: linux/amd64,linux/arm64
---
kind: golang.Build
spec:
outputs:
linux-amd64:
GOOS: linux
GOARCH: amd64
linux-arm64:
GOOS: linux
GOARCH: arm64
---
kind: common.Repository
spec:
conformLicenseCheck: false
Expand Down
16 changes: 14 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-10-10T13:37:23Z by kres 34e72ac.
# Generated on 2024-10-18T12:33:47Z by kres 34e72ac.

ARG TOOLCHAIN

Expand Down Expand Up @@ -79,7 +79,15 @@ COPY --from=generate / /
WORKDIR /src/cmd/release-tool
ARG GO_BUILDFLAGS
ARG GO_LDFLAGS
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS}" -o /release-tool-linux-amd64
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg GOARCH=amd64 GOOS=linux go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS}" -o /release-tool-linux-amd64

# builds release-tool-linux-arm64
FROM base AS release-tool-linux-arm64-build
COPY --from=generate / /
WORKDIR /src/cmd/release-tool
ARG GO_BUILDFLAGS
ARG GO_LDFLAGS
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg GOARCH=arm64 GOOS=linux go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS}" -o /release-tool-linux-arm64

# runs unit-tests with race detector
FROM base AS unit-tests-race
Expand All @@ -96,13 +104,17 @@ RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/g
FROM scratch AS release-tool-linux-amd64
COPY --from=release-tool-linux-amd64-build /release-tool-linux-amd64 /release-tool-linux-amd64

FROM scratch AS release-tool-linux-arm64
COPY --from=release-tool-linux-arm64-build /release-tool-linux-arm64 /release-tool-linux-arm64

FROM scratch AS unit-tests
COPY --from=unit-tests-run /src/coverage.txt /coverage-unit-tests.txt

FROM release-tool-linux-${TARGETARCH} AS release-tool

FROM scratch AS release-tool-all
COPY --from=release-tool-linux-amd64 / /
COPY --from=release-tool-linux-arm64 / /

FROM base-image-release-tool AS image-release-tool
RUN apk add --no-cache git git-lfs make sed
Expand Down
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-10-10T13:37:23Z by kres 34e72ac.
# Generated on 2024-10-18T12:33:47Z by kres 34e72ac.

# common variables

Expand Down Expand Up @@ -182,8 +182,15 @@ $(ARTIFACTS)/release-tool-linux-amd64:
.PHONY: release-tool-linux-amd64
release-tool-linux-amd64: $(ARTIFACTS)/release-tool-linux-amd64 ## Builds executable for release-tool-linux-amd64.

.PHONY: $(ARTIFACTS)/release-tool-linux-arm64
$(ARTIFACTS)/release-tool-linux-arm64:
@$(MAKE) local-release-tool-linux-arm64 DEST=$(ARTIFACTS)

.PHONY: release-tool-linux-arm64
release-tool-linux-arm64: $(ARTIFACTS)/release-tool-linux-arm64 ## Builds executable for release-tool-linux-arm64.

.PHONY: release-tool
release-tool: release-tool-linux-amd64 ## Builds executables for release-tool.
release-tool: release-tool-linux-amd64 release-tool-linux-arm64 ## Builds executables for release-tool.

.PHONY: lint-markdown
lint-markdown: ## Runs markdownlint.
Expand Down

0 comments on commit 145d0a3

Please sign in to comment.