|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +OS = $(shell uname) |
| 4 | +UID = $(shell id -u) |
| 5 | +DOCKER_NETWORK = lexthink-php_skeleton-network |
| 6 | +DOCKER_PHP = lexthink-php_skeleton-php |
| 7 | + |
| 8 | +help: ## Show this help message |
| 9 | + @echo 'usage: make [target]' |
| 10 | + @echo |
| 11 | + @echo 'targets:' |
| 12 | + @egrep '^(.+)\:\ ##\ (.+)' ${MAKEFILE_LIST} | column -t -c 2 -s ':#' |
| 13 | + |
| 14 | +build: ## Rebuilds all the containers |
| 15 | + docker network create ${DOCKER_NETWORK} || true |
| 16 | + cp -n docker-compose.yaml.dist docker-compose.yaml || true |
| 17 | + cp -n .env.dist .env || true |
| 18 | + U_ID=${UID} docker-compose build |
| 19 | + |
| 20 | +start: ## Start the containers |
| 21 | + docker network create ${DOCKER_NETWORK} || true |
| 22 | + cp -n docker-compose.yaml.dist docker-compose.yaml || true |
| 23 | + cp -n .env.dist .env || true |
| 24 | + U_ID=${UID} docker-compose up -d |
| 25 | + |
| 26 | +stop: ## Stop the containers |
| 27 | + U_ID=${UID} docker-compose stop |
| 28 | + |
| 29 | +restart: ## Restart the containers |
| 30 | + $(MAKE) stop && $(MAKE) start |
| 31 | + |
| 32 | +install: ## Installs composer dependencies |
| 33 | + U_ID=${UID} docker exec --user ${UID} ${DOCKER_PHP} composer install --no-interaction |
| 34 | + |
| 35 | +migrations: ## Runs doctrine migrations |
| 36 | + U_ID=${UID} docker exec --user ${UID} ${DOCKER_PHP} bin/console doctrine:migration:migrate -n --allow-no-migration |
| 37 | + |
| 38 | +logs: ## Tails the Symfony dev log |
| 39 | + U_ID=${UID} docker exec --user ${UID} ${DOCKER_PHP} tail -f var/log/dev.log |
| 40 | + |
| 41 | +bash: ## bash into the be container |
| 42 | + U_ID=${UID} docker exec -it --user ${UID} ${DOCKER_PHP} bash |
| 43 | + |
| 44 | +fix-style: ## Fix code style errors using php-cs-fixer and phpcbf |
| 45 | + U_ID=${UID} docker exec --user ${UID} ${DOCKER_PHP} composer dev:fix-style |
| 46 | + |
| 47 | +tests: ## Runs the entire test suite |
| 48 | + U_ID=${UID} docker exec --user ${UID} ${DOCKER_PHP} composer dev:tests |
| 49 | + |
| 50 | +coverage: ## Runs phpunit with xdebug and storage coverage in var/coverage/html/ |
| 51 | + U_ID=${UID} docker exec --user ${UID} ${DOCKER_PHP} composer dev:coverage |
| 52 | + |
| 53 | +.PHONY: help build start stop restart install migrations logs bash fix-style tests coverage |
0 commit comments