Skip to content

Commit

Permalink
support for arm64
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Couture-Beil <[email protected]>
  • Loading branch information
alexcb committed Nov 23, 2022
1 parent ffd8b4a commit acacfa8
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,41 +49,62 @@ colorgrep:
RUN test -n "$GOOS" && test -n "$GOARCH"
ARG GOCACHE=/go-cache
RUN mkdir -p build
ENV CGO_ENABLED=0
RUN --mount=type=cache,target=$GOCACHE \
go build \
-o build/colorgrep \
-ldflags "-X main.Version=$RELEASE_TAG $GO_EXTRA_LDFLAGS" \
cmd/main.go
SAVE ARTIFACT build/colorgrep AS LOCAL "build/$GOOS/$GOARCH/colorgrep"

colorgrep-darwin:
colorgrep-darwin-amd64:
COPY \
--build-arg GOOS=darwin \
--build-arg GOARCH=amd64 \
--build-arg GO_EXTRA_LDFLAGS= \
+colorgrep/colorgrep /build/colorgrep
SAVE ARTIFACT /build/colorgrep AS LOCAL "build/darwin/amd64/colorgrep"

colorgrep-linux:
colorgrep-darwin-arm64:
COPY \
--build-arg GOOS=darwin \
--build-arg GOARCH=arm64 \
--build-arg GO_EXTRA_LDFLAGS= \
+colorgrep/colorgrep /build/colorgrep
SAVE ARTIFACT /build/colorgrep AS LOCAL "build/darwin/amd64/colorgrep"

colorgrep-linux-amd64:
COPY \
--build-arg GOOS=linux \
--build-arg GOARCH=amd64 \
--build-arg GO_EXTRA_LDFLAGS="-linkmode external -extldflags -static" \
+colorgrep/colorgrep /build/colorgrep
SAVE ARTIFACT /build/colorgrep AS LOCAL "build/linux/amd64/colorgrep"

colorgrep-linux-arm64:
COPY \
--build-arg GOOS=linux \
--build-arg GOARCH=arm64 \
--build-arg GO_EXTRA_LDFLAGS= \
+colorgrep/colorgrep /build/colorgrep
SAVE ARTIFACT /build/colorgrep AS LOCAL "build/linux/amd64/colorgrep"

colorgrep-all:
COPY +colorgrep-linux/root/colorgrep ./colorgrep-linux-amd64
COPY +colorgrep-darwin/colorgrep ./colorgrep-darwin-amd64
COPY +colorgrep-linux-amd64/root/colorgrep ./colorgrep-linux-amd64
COPY +colorgrep-linux-arm64/root/colorgrep ./colorgrep-linux-arm64
COPY +colorgrep-darwin-amd64/colorgrep ./colorgrep-darwin-amd64
COPY +colorgrep-darwin-arm64/colorgrep ./colorgrep-darwin-arm64
SAVE ARTIFACT ./*


release:
FROM node:13.10.1-alpine3.11
RUN npm install -g [email protected]
WORKDIR /release
COPY +colorgrep-linux/colorgrep ./colorgrep-linux-amd64
COPY +colorgrep-darwin/colorgrep ./colorgrep-darwin-amd64
COPY +colorgrep-linux-amd64/colorgrep ./colorgrep-linux-amd64
COPY +colorgrep-linux-arm64/colorgrep ./colorgrep-linux-arm64
COPY +colorgrep-darwin-amd64/colorgrep ./colorgrep-darwin-amd64
COPY +colorgrep-darwin-arm64/colorgrep ./colorgrep-darwin-arm64
ARG --required RELEASE_TAG
ARG EARTHLY_GIT_HASH
ARG BODY="No details provided"
Expand Down

0 comments on commit acacfa8

Please sign in to comment.