This repository has been archived by the owner on Jul 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
48 lines (41 loc) · 1.87 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
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
.PHONY: all
all: docker
.PHONY: dist
dist:
CGO_ENABLED=0 GOOS=linux go build -ldflags $(LDFLAGS) -a -installsuffix cgo -o bin/inlets
CGO_ENABLED=0 GOOS=darwin go build -ldflags $(LDFLAGS) -a -installsuffix cgo -o bin/inlets-darwin
# CGO_ENABLED=0 GOOS=freebsd go build -ldflags $(LDFLAGS) -a -installsuffix cgo -o bin/inlets-freebsd
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags $(LDFLAGS) -a -installsuffix cgo -o bin/inlets-armhf
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags $(LDFLAGS) -a -installsuffix cgo -o bin/inlets-arm64
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags $(LDFLAGS) -a -installsuffix cgo -o bin/inlets.exe
.PHONY: docker-local
docker-local:
docker build \
-t ghcr.io/inlets/inlets:$(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 \
--output "type=image,push=false" \
--tag ghcr.io/inlets/inlets:$(Version) .
.PHONY: docker-login
docker-login:
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 \
--output "type=image,push=true" \
--tag ghcr.io/inlets/inlets:$(Version) .