-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
57 lines (49 loc) · 1.29 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
VERSION := $(shell git describe --tags --always --abbrev=8)
SYSTEM :=
BUILDFLAGS := -trimpath -ldflags="-s -w -X main.Version=$(VERSION)"
IMPORT_PATH := github.com/milgradesec/ddns
GOBIN := $(shell go env GOBIN)
ifeq ($(GOBIN),)
GOBIN = $(shell go env GOPATH)/bin
endif
.PHONY: all
all: build
.PHONY: build
build:
go build $(BUILDFLAGS) $(IMPORT_PATH)/cmd/ddns
.PHONY: lint
lint: $(GOBIN)/golangci-lint
$(GOBIN)/golangci-lint run
.PHONY: test
test:
go test -v ./...
.PHONY: cover
cover:
go test \
-v \
-race \
-coverprofile=coverage.txt \
-covermode=atomic ./...
.PHONY: docker
docker: build
docker build . -f Dockerfile
.PHONY: release
release:
docker buildx build . -f build.Dockerfile \
--platform linux/amd64 \
--tag ghcr.io/milgradesec/ddns:amd64 \
--push
docker buildx build . -f build.Dockerfile \
--platform linux/arm64 \
--tag ghcr.io/milgradesec/ddns:arm64 \
--push
docker manifest create ghcr.io/milgradesec/ddns:$(VERSION) \
ghcr.io/milgradesec/ddns:arm64 \
ghcr.io/milgradesec/ddns:amd64
docker manifest create ghcr.io/milgradesec/ddns:latest \
ghcr.io/milgradesec/ddns:arm64 \
ghcr.io/milgradesec/ddns:amd64
docker manifest push \
--purge ghcr.io/milgradesec/ddns:$(VERSION)
docker manifest push \
--purge ghcr.io/milgradesec/ddns:latest