-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmakefile
41 lines (31 loc) · 1.09 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
SHORT_HASH = $(shell git rev-parse --short HEAD)
BUILD_DATE = $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
VERSION = develop
META_PKG = main
LDFLAGS += -X '$(META_PKG).shortHash=$(SHORT_HASH)'
LDFLAGS += -X '$(META_PKG).build=$(VERSION)'
LDFLAGS += -s -w
.PHONY: dev.setup
dev.setup:
go mod tidy
go install github.com/golangci/golangci-lint/cmd/[email protected]
.PHONY: build
build:
CGO_ENABLED=0 go build -ldflags "$(LDFLAGS)" -o graphql-protect ./cmd/.
x-build:
GOOS=linux GOARCH=amd64 make build
.PHONY: test
test:
go test -v ./...
.PHONY: lint
## Runs a linter over the code
lint:
golangci-lint run --timeout 3m
.PHONY: build_container
build_container: build
docker build . -t graphql-protect --build-arg BUILD_DATE=$(BUILD_DATE) --build-arg VERSION=$(VERSION) --build-arg REVISION=$(SHORT_HASH)
x_build_container: x-build
docker buildx build --platform="linux/amd64" -t graphql-protect --build-arg BUILD_DATE=$(BUILD_DATE) --build-arg VERSION=$(VERSION) --build-arg REVISION=$(SHORT_HASH) .
.PHONY: run_container
run_container: build_container
docker run -itd --rm -p 8080:8080 graphql-protect