Skip to content

Commit

Permalink
rename 'make release' into 'make binaries'
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 committed Sep 17, 2022
1 parent 2317e48 commit bfb9161
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 35 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/binaries
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/binaries
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ help:
@echo " test run tests"
@echo " lint run linter"
@echo " run ARGS=args run app"
@echo " release build release assets"
@echo " binaries build binaries for all platforms"
@echo " dockerhub build and push docker hub images"
@echo ""

Expand Down
34 changes: 34 additions & 0 deletions scripts/binaries.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
define DOCKERFILE_BINARIES
FROM amd64/$(BASE_IMAGE)
RUN apk add --no-cache zip make git tar
WORKDIR /s
COPY go.mod go.sum ./
RUN go mod download
COPY . ./
RUN make binaries-nodocker
endef
export DOCKERFILE_BINARIES

binaries:
echo "$$DOCKERFILE_BINARIES" | docker build . -f - -t temp \
&& docker run --rm -v $(PWD):/out \
temp sh -c "rm -rf /out/binaries && cp -r /s/binaries /out/"

binaries-nodocker:
$(eval export CGO_ENABLED=0)
$(eval VERSION := $(shell git describe --tags))
$(eval GOBUILD := go build -ldflags '-X main.version=$(VERSION)')
rm -rf tmp && mkdir tmp
rm -rf binaries && mkdir binaries

GOOS=linux GOARCH=amd64 $(GOBUILD) -o tmp/landiscover
tar -C tmp -czf $(PWD)/binaries/landiscover_$(VERSION)_linux_amd64.tar.gz --owner=0 --group=0 landiscover

GOOS=linux GOARCH=arm GOARM=6 $(GOBUILD) -o tmp/landiscover
tar -C tmp -czf $(PWD)/binaries/landiscover_$(VERSION)_linux_arm6.tar.gz --owner=0 --group=0 landiscover

GOOS=linux GOARCH=arm GOARM=7 $(GOBUILD) -o tmp/landiscover
tar -C tmp -czf $(PWD)/binaries/landiscover_$(VERSION)_linux_arm7.tar.gz --owner=0 --group=0 landiscover

GOOS=linux GOARCH=arm64 $(GOBUILD) -o tmp/landiscover
tar -C tmp -czf $(PWD)/binaries/landiscover_$(VERSION)_linux_arm64v8.tar.gz --owner=0 --group=0 landiscover
34 changes: 0 additions & 34 deletions scripts/release.mk

This file was deleted.

0 comments on commit bfb9161

Please sign in to comment.