Skip to content

Commit

Permalink
Merge pull request #79 from EmakinaFR/feature/rename-make-commands
Browse files Browse the repository at this point in the history
Rename makefile commands for consistency
  • Loading branch information
matthieupetel committed Jan 25, 2022
2 parents c8d7caf + 4dcf311 commit efef02a
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions Makefile
Expand Up @@ -16,58 +16,58 @@ export PROJECT_LOCATION := $(shell echo ${MAKEFILE_DIRECTORY})
## ----------------------------------------------------------------------------
##

env-backup: ## Backup the "mysql" volume
backup: ## Backup the "mysql" volume
docker run --rm \
--volumes-from $$(docker compose ps -q mysql) \
--volume $$(pwd):/backup \
busybox sh -c "tar cvf /backup/backup.tar /var/lib/mysql"

env-build: ## Build the environment
build: ## Build the environment
docker compose build --pull

env-cache: ## Flush cache in Redis
cache: ## Flush cache in Redis
docker compose exec redis sh -c "redis-cli FLUSHALL"

env-logs: ## Follow logs generated by all containers
logs: ## Follow logs generated by all containers
docker compose logs -f --tail=0

env-logs-full: ## Follow logs generated by all containers from the containers creation
logs-full: ## Follow logs generated by all containers from the containers creation
docker compose logs -f

env-mysql: ## Open a terminal in the "mysql" container
mysql: ## Open a terminal in the "mysql" container
docker compose exec mysql sh

env-nginx: ## Open a terminal in the "nginx" container
nginx: ## Open a terminal in the "nginx" container
docker compose exec -u nginx:nginx nginx sh -l

env-php: ## Open a terminal in the "php" container
php: ## Open a terminal in the "php" container
docker compose exec -u www-data:www-data php bash -l -c "source ./project.sh use && /bin/bash"

env-phpl: ## Open a terminal in the "php" container and prompt source locale
phpl: ## Open a terminal in the "php" container and prompt source locale
@read -p "Enter locale: " locale; \
docker compose exec -u www-data:www-data php bash -l -c "source ./project.sh use $$locale && /bin/bash"

source: ## Set source with given locale
@read -p "Enter locale: " locale; \
source ./project.sh use $$locale

env-ps: ## List all containers managed by the environment
ps: ## List all containers managed by the environment
docker compose ps

env-purge: ## Purge all services and associated volumes
purge: ## Purge all services and associated volumes
docker compose down -v
mutagen sync terminate --label-selector='name==${COMPOSE_PROJECT_NAME}'

env-restart: env-stop env-start ## Restart the environment
restart: stop start ## Restart the environment

env-restore: ## Restore the "mysql" volume
restore: ## Restore the "mysql" volume
docker run --rm \
--volumes-from $$(docker compose ps -q mysql) \
--volume $$(pwd):/backup \
busybox sh -c "tar xvf /backup/backup.tar var/lib/mysql/"
docker compose restart mysql

env-start: ## Start the environment
start: ## Start the environment
@docker compose up --detach --remove-orphans

@if [[ ! "$$(mutagen sync list --label-selector='name==${COMPOSE_PROJECT_NAME}')" =~ "${COMPOSE_PROJECT_NAME}" ]]; then \
Expand All @@ -87,25 +87,25 @@ env-start: ## Start the environment
sleep 10; \
done

env-stats: ## Print real-time statistics about containers ressources usage
stats: ## Print real-time statistics about containers ressources usage
docker stats $(docker ps --format={{.Names}})

env-stop: ## Stop the environment
stop: ## Stop the environment
@docker compose stop
@mutagen sync pause --label-selector='name==${COMPOSE_PROJECT_NAME}'

.PHONY: env-backup env-build env-cache env-logs env-logs env-mysql env-nginx env-php env-ps env-purge env-restart env-restore env-start env-stats env-stop
.PHONY: backup build cache logs logs mysql nginx php ps purge restart restore start stats stop

##
## ----------------------------------------------------------------------------
## Pipelines
## ----------------------------------------------------------------------------
##

ci: ## Continuous integration
ci: ## Run continuous integration analysis
@make phpcsfixer-audit phpstan eslint stylelint

ci-fix: ## Continuous integration
ci-fix: ## Run continuous integration fixes
@make phpcsfixer eslint-fix stylelint-fix

phpcsfixer: ## Execute the code style analysis and fix on all PHP files
Expand Down

0 comments on commit efef02a

Please sign in to comment.