-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (42 loc) · 976 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
48
49
50
51
52
53
54
55
56
57
58
APP=agent
SERVER_IMAGE=logann131/nftir-agent:$(SERVER_TAG)
SERVER_TAG=1.0
DOCKER_RMI=docker rmi -f
DOCKER_COMPOSE_BUILD=docker compose build --no-cache
DOCKER_COMPOSE_DOWN=docker compose down
DOCKER_COMPOSE_REMOVE=docker compose
DOCKER_COMPOSE_UP=docker compose up -d
## Development mode
.PHONY: go-build-local
go-build-local: clean build run
.PHONY: clean
clean:
go $@
.PHONY: agent
build: agent
go $@ -o $< .
run: agent
./$<
## Production mode
.PHONY: start-image
start-image: remove-image build-image
.PHONY: remove-image
remove-image:
$(DOCKER_RMI) $(SERVER_IMAGE)
.PHONY: build-image
build-image:
$(DOCKER_COMPOSE_BUILD)
.PHONY: start-container
start-container: down-container up-container
.PHONY: down-container
down-container:
$(DOCKER_COMPOSE_DOWN)
.PHONY: up-container
up-container:
$(DOCKER_COMPOSE_UP)
## Clean app
.PHONY: clean-app
clean-app: down-container remove-image
## build app
.PHONY: build-app
build-app: start-image start-container