-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (56 loc) · 2.2 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
64
65
66
67
68
69
70
71
72
73
74
75
76
include .env
.PHONY: up down stop prune ps shell drush logs build clean site-install build build-fe build-fe build-fe-install
.PHONY: build-fe-generate
default: up
APP_ROOT ?= /var/www/html
DRUPAL_ROOT ?= $(APP_ROOT)/docroot
DRUPAL_SITE_DIR ?= $(DRUPAL_ROOT)/sites/default
SMG_THEME ?= $(DRUPAL_ROOT)/themes/smg
up:
@echo "Starting up containers for $(PROJECT_NAME)..."
docker-compose pull
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
shell-node:
docker exec -ti -e COLUMNS=$(shell tput cols) -e LINES=$(shell tput lines) $(shell docker ps --filter name='$(PROJECT_NAME)_node' --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))
build: build-fe build-be
build-fe: build-fe-install build-fe-generate
build-fe-install:
@docker-compose run node npm install
build-fe-generate:
@docker-compose run node npx gulp
build-be:
@docker-compose exec php composer install
# It feels a little silly using docker to kill files (and weird to use the php
# container to kill node_modules - but it works for now).
clean:
@docker-compose exec php bash -c "composer clearcache; \
rm -rf $(APP_ROOT)/vendor \
$(DRUPAL_ROOT)/core \
$(DRUPAL_ROOT)/profiles \
$(DRUPAL_ROOT)/modules/contrib \
$(DRUPAL_ROOT)/themes/contrib \
$(DRUPAL_ROOT)/themes/contrib \
$(SMG_THEME)/node_modules"
site-install:
@docker-compose exec php bash -c "chmod +w $(DRUPAL_ROOT)/sites/default $(DRUPAL_ROOT)/sites/default/settings.php"
@time docker-compose exec php \
drush site-install --verbose --account-pass=admin --yes \
config_installer config_installer_sync_configure_form.sync_directory=$(APP_ROOT)/config
# https://stackoverflow.com/a/6273809/1826109
%:
@: