-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (25 loc) · 771 Bytes
/
Makefile
File metadata and controls
36 lines (25 loc) · 771 Bytes
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
TARGET_EXEC := app
PORT := 8080
VERSION := local
default: clean build lint test
tidy:
go mod tidy
build: tidy
go build -o $(TARGET_EXEC) -ldflags '-w -X main.Version=$(VERSION)' .
test:
go test -shuffle=on -race -coverprofile=coverage.txt ./...
lint: tidy
golangci-lint run
go run golang.org/x/tools/cmd/deadcode@latest -test ./...
run: build
PORT=$(PORT) ./$(TARGET_EXEC)
clean:
rm -rf coverage.txt $(TARGET_EXEC)
IMAGE := ghcr.io/raeperd/kickstart
DOCKER_VERSION := $(if $(VERSION),$(subst /,-,$(VERSION)),latest)
docker:
docker build . --build-arg VERSION=$(VERSION) -t $(IMAGE):$(DOCKER_VERSION)
docker-run: docker
docker run --rm -p $(PORT):8080 $(IMAGE):$(DOCKER_VERSION)
docker-clean:
docker image rm -f $(IMAGE):$(DOCKER_VERSION) || true