-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
63 lines (45 loc) · 1.38 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
export BOX_VERSION ?= 1.4.0
export BOX_NAME ?= jenkins-lab-demo
export BOX_FILE ?= $(CURDIR)/jenkins-lab-demo.box
GIT_SUBPROJECT := alpine2docker
CUSTOMIZE_DIR := $(GIT_SUBPROJECT)/customize
TMP_LAB_DIR := ./tmp-lab
EXTERNAL_PORT ?= 10000
TESTS_URL ?= http://localhost:$(EXTERNAL_PORT)
export DOCKER_USERNAME ?= dduportal
all: box lab
lab: clean-lab init-lab start-lab
clean: clean-lab clean-box
box: clean-box build-box test clean-box
docker:
cd ./docker && docker-compose build
docker-deploy:
cd ./docker && docker-compose push
build-box: $(BOX_FILE)
build-aws:
packer build -only=aws $(CURDIR)/packer.json
deploy-aws:
@cd deploy/aws; terraform apply
test:
TESTS_URL=$(TESTS_URL) bats $(CURDIR)/tests/*.bats
$(BOX_FILE):
cp -r ./docker/ ./$(CUSTOMIZE_DIR)
cp ./vagrantfile-box.tpl ./$(GIT_SUBPROJECT)/
cd $(GIT_SUBPROJECT) && make all
init-lab:
vagrant box add --force $(BOX_NAME)-lab $(BOX_FILE)
mkdir -p $(TMP_LAB_DIR)
cd $(TMP_LAB_DIR) && vagrant init -m -f $(BOX_NAME)-lab
start-lab:
cd $(TMP_LAB_DIR) && vagrant up
suspend-lab:
cd $(TMP_LAB_DIR) && vagrant suspend
clean-lab:
cd $(TMP_LAB_DIR) && vagrant destroy -f || true
rm -rf $(TMP_LAB_DIR)
vagrant global-status --prune
clean-box:
rm -rf $(BOX_FILE) $(CUSTOMIZE_DIR)
cd $(GIT_SUBPROJECT) && git checkout .
.PHONY: all lab box clean build-box clean-box start-lab clean-lab \
suspend-lab test docker docker-deploy