-
Notifications
You must be signed in to change notification settings - Fork 535
/
docker.mk
38 lines (26 loc) · 902 Bytes
/
docker.mk
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
include .env
.PHONY: up down stop prune ps shell drush logs
default: up
DRUPAL_ROOT ?= /var/www/html/web
up:
@echo "Starting up containers for $(PROJECT_NAME)..."
docker-compose pull --parallel
docker-compose up -d --remove-orphans
down: stop
stop:
@echo "Stopping containers for $(PROJECT_NAME)..."
@docker-compose stop
prune:
@echo "Removing containers for $(PROJECT_NAME)..."
@docker-compose down -v
ps:
@docker ps --filter name='$(PROJECT_NAME)*'
shell:
docker exec -ti -e COLUMNS=$(shell tput cols) -e LINES=$(shell tput lines) $(shell docker ps --filter name='$(PROJECT_NAME)_php' --format "{{ .ID }}") sh
drush:
docker exec $(shell docker ps --filter name='$(PROJECT_NAME)_php' --format "{{ .ID }}") drush -r $(DRUPAL_ROOT) $(filter-out $@,$(MAKECMDGOALS))
logs:
@docker-compose logs -f $(filter-out $@,$(MAKECMDGOALS))
# https://stackoverflow.com/a/6273809/1826109
%:
@: