-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (36 loc) · 1023 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
39
40
41
42
43
44
45
46
47
registry = my.registry.host/my_repo_name
project = my_project_name
image = ${registry}/${project}
version ?=
env ?= production
arch = amd64
tag = ${version}-${env}-${arch}
table ?=
model ?=
.PHONY: check image push publish crud run-http run-cron code
check:
ifeq ($(registry),my.registry.host/my_repo_name)
$(error Please specify variables in Makefile: registry, project)
endif
ifeq ($(project),my_project_name)
$(error Please specify variables in Makefile: registry, project)
endif
ifeq ($(version),)
$(error image version not specified)
endif
@echo image tag: ${tag}
image: check
docker buildx build --platform=linux/amd64 --build-arg PUBLISH_MODE=${env} -t ${image}:${tag} .
push: check
docker push ${image}:${tag}
publish: image push
@echo "\n-------------------------\n\nComplete! Copy image name: \n\033[3;32m${image}:${tag}\033[0m"
crud:
bin/go run ./cmd/gencode -t ${table} -m ${model}
run-http:
bin/go run ./cmd/http
run-cron:
bin/go run ./cmd/cron
code:
gofmt -l -s -w ./
go vet -race ./...