This repository has been archived by the owner on Nov 5, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathMakefile
72 lines (63 loc) · 2.61 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Version := $(shell git describe --tags --dirty)
GitCommit := $(shell git rev-parse HEAD)
LDFLAGS := "-s -w -X main.Version=$(Version) -X main.GitCommit=$(GitCommit)"
# docker manifest command will work with Docker CLI 18.03 or newer
# but for now it's still experimental feature so we need to enable that
export DOCKER_CLI_EXPERIMENTAL=enabled
export GO111MODULE=off
.PHONY: all
all: docker
.PHONY: dist
dist:
CGO_ENABLED=0 GOOS=linux go build -ldflags $(LDFLAGS) -a -installsuffix cgo -o bin/jaas
CGO_ENABLED=0 GOOS=darwin go build -ldflags $(LDFLAGS) -a -installsuffix cgo -o bin/jaas-darwin
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags $(LDFLAGS) -a -installsuffix cgo -o bin/jaas-armhf
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags $(LDFLAGS) -a -installsuffix cgo -o bin/jaas-arm64
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags $(LDFLAGS) -a -installsuffix cgo -o bin/jaas.exe
./hack/hashgen.sh
.PHONY: docker-local
docker-local:
@docker buildx create --use --name=multiarch --node multiarch && \
docker buildx build \
--progress=plain \
--build-arg VERSION=$(Version) --build-arg GIT_COMMIT=$(GitCommit) \
--build-arg LDFLAGS=$(LDFLAGS) \
--platform linux/amd64 \
--output "type=docker,push=false" \
--tag alexellis2/jaas:$(Version) .
.PHONY: docker
docker:
@docker buildx create --use --name=multiarch --node multiarch && \
docker buildx build \
--progress=plain \
--build-arg VERSION=$(Version) --build-arg GIT_COMMIT=$(GitCommit) \
--platform linux/amd64,linux/arm/v6,linux/arm64 \
--build-arg LDFLAGS=$(LDFLAGS) \
--output "type=image,push=false" \
--tag alexellis2/jaas:$(Version) .
.PHONY: docker-login
docker-login:
echo -n "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
.PHONY: docker-login-ghcr
docker-login-ghcr:
echo -n "${GHCR_PASSWORD}" | docker login -u "${GHCR_USERNAME}" --password-stdin ghcr.io
.PHONY: push
push:
@docker buildx create --use --name=multiarch --node multiarch && \
docker buildx build \
--progress=plain \
--build-arg VERSION=$(Version) --build-arg GIT_COMMIT=$(GitCommit) \
--platform linux/amd64,linux/arm/v6,linux/arm64 \
--build-arg LDFLAGS=$(LDFLAGS) \
--output "type=image,push=true" \
--tag alexellis2/jaas:$(Version) .
.PHONY: push-ghcr
push-ghcr:
@docker buildx create --use --name=multiarch --node multiarch && \
docker buildx build \
--progress=plain \
--build-arg VERSION=$(Version) --build-arg GIT_COMMIT=$(GitCommit) \
--platform linux/amd64,linux/arm/v6,linux/arm64 \
--build-arg LDFLAGS=$(LDFLAGS) \
--output "type=image,push=true" \
--tag ghcr.io/alexellis/jaas:$(Version) .