-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
38 lines (27 loc) · 1021 Bytes
/
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
.PHONY: help build build-local up down logs ps test
.DEFAULT_GOAL := help
DOCKER_TAG := latest
build: ## Build docker image to deploy
docker build -t hdisc/gotodo:${DOCKER_TAG} \
--target deploy ./
build-local: ## Build docker image to local development
docker compose build --no-cache
up: ## Do docker compose up with hot reload
docker compose up -d
down: ## Do docker compose down
docker compose down
logs: ## Tail docker compose logs
docker compose logs -f
ps: ## Check container status
docker compose ps
test: ## Execute tests
go test -race -shuffle=on ./...
dry-migrate: ## Try migration
mysqldef -u todo -p todo -h 127.0.0.1 -P 33306 todo --dry-run < ./_tools/mysql/schema.sql
migrate: ## Execute migration
mysqldef -u todo -p todo -h 127.0.0.1 -P 33306 todo < ./_tools/mysql/schema.sql
generate: ## Generate codes
go generate ./...
help: ## Show options
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'