-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (46 loc) · 996 Bytes
/
Copy pathMakefile
File metadata and controls
58 lines (46 loc) · 996 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Go parameters
GOCMD=go
GOTEST=$(GOCMD) test
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOMOD=$(GOCMD) mod
GOTIDY=$(GOMOD) tidy
GOVET=$(GOCMD) vet
BINARY_NAME=main
BINARY_UNIX=$(BINARY_NAME)_unix
# Build the application
build:
$(GOBUILD) -o $(BINARY_NAME) -v
# Run the application
run:
$(GOBUILD) -o $(BINARY_NAME) -v
./$(BINARY_NAME)
# Install dependencies
tidy:
$(GOTIDY)
# Run tests
test:
$(GOTEST) -v ./...
# Run vet to find suspicious constructs
vet:
$(GOVET) ./...
# Run all checks
check: vet test
# Build for production
build-prod:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_UNIX) -a -installsuffix cgo .
# Run docker build
docker-build:
docker build -t fing-app .
# Run docker-compose
docker-up:
docker-compose up -d
# Stop docker-compose
docker-down:
docker-compose down
# Clean build files
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
rm -f $(BINARY_UNIX)
.PHONY: build run test vet check build-prod docker-build docker-up docker-down clean tidy