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

fix: arm64 build targets #18

Merged
merged 1 commit into from
Oct 18, 2024
Merged
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
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