-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
83 lines (66 loc) · 1.48 KB
/
Copy pathMakefile
File metadata and controls
83 lines (66 loc) · 1.48 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
DOCKER_DIR := docker
SRC_DIR := src
TF_DIR := terraform
.PHONY: help
help:
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
# Docker Compose commands
.PHONY: build
build: ## Build the Docker containers
docker-compose build
.PHONY: up
up: ## Start the Docker containers
docker-compose up -d
.PHONY: down
down: ## Stop the Docker containers
docker-compose down
.PHONY: restart
restart: ## Restart the Docker containers
docker-compose restart
.PHONY: logs
logs: ## Show the logs of the Docker containers
docker-compose logs -f
# Go commands
.ONESHELL:
.PHONY: init
init: ## Install development tools and project dependencies
go install github.com/securego/gosec/v2/cmd/gosec@latest;
go install honnef.co/go/tools/cmd/staticcheck@latest;
cd $(SRC_DIR);
go mod download
.ONESHELL:
.PHONY: tidy
tidy: ## Tidy Go dependencies
cd $(SRC_DIR);
go mod tidy
.ONESHELL:
.PHONY: test
test: ## Run Go tests
cd $(SRC_DIR);
go test -v -cover ./...
.ONESHELL:
.PHONY: format
format: ## Format Go code
cd $(SRC_DIR);
go fmt ./...
.ONESHELL:
.PHONY: vet
vet: ## Vet Go code
cd $(SRC_DIR);
go vet ./...
.ONESHELL:
.PHONY: lint
lint: ## Lint Go code
cd $(SRC_DIR);
staticcheck ./...
.ONESHELL:
.PHONY: sec
sec: ## Run Go security checks
cd $(SRC_DIR);
gosec ./...
# Terraform commands
.ONESHELL:
.PHONY: tf
tf: ## Run Terraform commands in the Terraform directory: make tf <command>; e.g. make tf plan
cd $(TF_DIR);
terraform $(filter-out $@,$(MAKECMDGOALS))