-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
67 lines (56 loc) · 1.62 KB
/
makefile
File metadata and controls
67 lines (56 loc) · 1.62 KB
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
64
65
66
67
IMAGE_NAME := $(shell grep 'name:' Jenkinsfile | sed "s/.\+'\(.\+\)'.\+/\1/g")
CONTAINER_CMD := docker
COMPOSE_FILES := -f docker-compose.yml
ifneq (,$(wildcard docker-compose.ssh.yml))
COMPOSE_FILES += -f docker-compose.ssh.yml
endif
default:
@echo "Usage:"
@echo " make build"
@echo
@echo " Builds the $(IMAGE_NAME) image for local use."
@echo
@echo " make start"
@echo
@echo " Starts the compose stack for this plugin in the background."
@echo
@echo " make stop"
@echo
@echo " Shuts down a running compose stack for this plugin."
@echo
@echo " make destroy"
@echo
@echo " Shuts down and purges state for the compose stack for this plugin."
@echo
@echo " make logs"
@echo
@echo " Binds the current console to the log output docker stack."
@echo
@echo ' Equivalent to `tail -f $$LOG_FILE_PATH`'
@echo
@echo " make shell-cmd"
@echo
@echo " Echos a command to open a bash session in a running instance of this"
@echo " project's $(IMAGE_NAME) image."
@echo
@echo ' Intended to be used with eval:'
@echo ' $$ eval `make shell-cmd`'
build:
@$(CONTAINER_CMD) compose build
start: .env
@mkdir -p mount/$$(grep 'SITE_BUILD=' .env | cut -d= -f2)
@$(CONTAINER_CMD) compose $(COMPOSE_FILES) up -d;
stop: .env
@$(CONTAINER_CMD) compose $(COMPOSE_FILES) stop
destroy: .env
@$(CONTAINER_CMD) compose $(COMPOSE_FILES) down -v --remove-orphans
shell-cmd:
@echo $(CONTAINER_CMD) exec -it $${PWD##*/}-plugin-1 bash
logs: .env
@$(CONTAINER_CMD) compose $(COMPOSE_FILES) logs -f
# TESTS
.env:
@echo >&2
@echo ".env file must be configured before running the stack." >&2
@echo >&2
@exit 1