Skip to content

Commit de181b5

Browse files
authored
Merge pull request wodby#369 from irmantasp/master
Implement Self-Documenting Makefiles
2 parents 5c1707e + 9944f08 commit de181b5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docker.mk

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,46 @@ default: up
66

77
DRUPAL_ROOT ?= /var/www/html/web
88

9+
## help : Print commands help.
10+
help : docker.mk
11+
@sed -n 's/^##//p' $<
12+
13+
## up : Start up containers.
914
up:
1015
@echo "Starting up containers for $(PROJECT_NAME)..."
1116
docker-compose pull
1217
docker-compose up -d --remove-orphans
1318

19+
## down : Stop containers.
1420
down: stop
1521

22+
## stop : Stop containers.
1623
stop:
1724
@echo "Stopping containers for $(PROJECT_NAME)..."
1825
@docker-compose stop
1926

27+
## prune : Remove containers and their volumes.
2028
prune:
2129
@echo "Removing containers for $(PROJECT_NAME)..."
2230
@docker-compose down -v
2331

32+
## ps : List running containers.
2433
ps:
2534
@docker ps --filter name='$(PROJECT_NAME)*'
2635

36+
## shell : Access `php` container via shell.
2737
shell:
2838
docker exec -ti -e COLUMNS=$(shell tput cols) -e LINES=$(shell tput lines) $(shell docker ps --filter name='$(PROJECT_NAME)_php' --format "{{ .ID }}") sh
2939

40+
## drush : Executes `drush` command in a specified `DRUPAL_ROOT` directory (default is `/var/www/html/web`).
41+
## Doesn't support --flag arguments.
3042
drush:
3143
docker exec $(shell docker ps --filter name='^/$(PROJECT_NAME)_php' --format "{{ .ID }}") drush -r $(DRUPAL_ROOT) $(filter-out $@,$(MAKECMDGOALS))
3244

45+
## logs : View containers logs.
46+
## You can optinally pass an argument with the service name to limit logs
47+
## logs php : View `php` container logs.
48+
## logs nginx php : View `nginx` and `php` containers logs.
3349
logs:
3450
@docker-compose logs -f $(filter-out $@,$(MAKECMDGOALS))
3551

0 commit comments

Comments
 (0)