-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
44 lines (42 loc) · 1.26 KB
/
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
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
UID:=$(shell id -u)
PLAYBOOK?=main.yml
clean:
rm -f ansible/dash-arm-build dash/dash
rm -f ansible/api-arm-build api/api
.PHONY: dash
dash: dash/*.go
docker run -it --rm \
-v $(ROOT_DIR):/project \
-e GOPATH=/project/.go \
-e GOCACHE=/project/.go/cache \
-e GOARCH=arm \
-w /project/dash \
-u $(UID) \
golang:1.13.8 go build -o ../ansible/dash-arm-build .
.PHONY: api
api: api/*.go
docker run -it --rm \
-v $(ROOT_DIR):/project \
-e GOPATH=/project/.go \
-e GOCACHE=/project/.go/cache \
-e GOARCH=arm \
-w /project/api \
-u $(UID) \
golang:1.13.8 go build -o ../ansible/api-arm-build .
.PHONY: playbook
playbook: dash api
docker run -w /project -e HOME=/project --rm -it \
-v $(ROOT_DIR)/ansible:/project \
-v $(ROOT_DIR)/known_hosts:/known_hosts \
-v $(SSH_AUTH_SOCK):/ssh-agent \
-e SSH_AUTH_SOCK=/ssh-agent \
ansible/ansible-runner ansible-playbook $(PLAYBOOK) -i inventory.yml
.PHONY: energy
energy:
docker run -w /project -e HOME=/project --rm -it \
-v $(ROOT_DIR)/energy:/project \
-v $(ROOT_DIR)/known_hosts:/known_hosts \
-v $(SSH_AUTH_SOCK):/ssh-agent \
-e SSH_AUTH_SOCK=/ssh-agent \
ansible/ansible-runner ansible-playbook $(PLAYBOOK) -i inventory.yml