-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
46 lines (34 loc) · 1.45 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
GITVERSION := $(shell git describe --tags --always)
GITCOMMIT := $(shell git log -1 --pretty=format:"%H")
BUILDDATE := $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
LDFLAGS += -s -w
LDFLAGS += -X github.com/patrickhoefler/dockerfilegraph/internal/cmd.gitVersion=$(GITVERSION)
LDFLAGS += -X github.com/patrickhoefler/dockerfilegraph/internal/cmd.gitCommit=$(GITCOMMIT)
LDFLAGS += -X github.com/patrickhoefler/dockerfilegraph/internal/cmd.buildDate=$(BUILDDATE)
FLAGS = -ldflags "$(LDFLAGS)"
build: clean
go build $(FLAGS)
build-docker-image-alpine: build-linux
docker build -t dockerfilegraph:alpine -f Dockerfile.alpine .
build-docker-image-ubuntu: build-linux
docker build -t dockerfilegraph:ubuntu -f Dockerfile .
build-linux: clean
GOOS=linux go build $(FLAGS)
clean:
go clean
example-images:
# Change to the root directory of the project.
cd $(git rev-parse --show-toplevel)
go run . -f examples/dockerfiles/Dockerfile --legend -o svg \
&& mv Dockerfile.svg examples/images/Dockerfile-legend.svg
go run . -f examples/dockerfiles/Dockerfile --layers -o svg \
&& mv Dockerfile.svg examples/images/Dockerfile-layers.svg
go run . -f examples/dockerfiles/Dockerfile.large -c -n 0.3 -o svg -u 4 \
&& mv Dockerfile.svg examples/images/Dockerfile-large.svg
lint:
# https://github.com/golangci/golangci-lint needs to be installed.
golangci-lint run
test:
go test ./... --coverprofile=cover.out
go install github.com/patrickhoefler/gocovergate@latest
gocovergate