forked from siderolabs/conform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (41 loc) · 1.33 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
SHA ?= $(shell git describe --match=none --always --abbrev=8)
TAG ?= $(shell git describe --tag --always)
GOLANG_IMAGE ?= golang:1.14
COMMON_ARGS := -f ./Dockerfile --build-arg GOLANG_IMAGE=$(GOLANG_IMAGE) --build-arg SHA=$(SHA) --build-arg TAG=$(TAG) .
export DOCKER_BUILDKIT := 1
all: enforce build test image
enforce:
@go run main.go enforce
.PHONY: build
build:
@docker build \
-t conform/$@:$(TAG) \
--target=$@ \
$(COMMON_ARGS)
@docker run --rm -v $(PWD)/build:/build conform/$@:$(TAG) cp /conform-linux-amd64 /build
@docker run --rm -v $(PWD)/build:/build conform/$@:$(TAG) cp /conform-darwin-amd64 /build
test:
@docker build \
-t conform/$@:$(TAG) \
--target=$@ \
$(COMMON_ARGS)
@docker run --rm -v $(PWD)/build:/build conform/$@:$(TAG) cp /coverage.txt /build
image: build
@docker build \
--network=host \
-t autonomy/conform:$(TAG) \
--target=$@ \
$(COMMON_ARGS)
.PHONY: login
login:
@docker login --username "$(DOCKER_USERNAME)" --password "$(DOCKER_PASSWORD)"
push: image
@docker tag autonomy/conform:$(TAG) autonomy/conform:latest
@docker push autonomy/conform:$(TAG)
@docker push autonomy/conform:latest
deps:
@GO111MODULE=on CGO_ENABLED=0 go get -u github.com/autonomy/gitmeta
@GO111MODULE=on CGO_ENABLED=0 go get -u github.com/talos-systems/conform
clean:
go clean -modcache
rm -rf build vendor