Makefile 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. DIR=$(strip $(notdir $(CURDIR))) # Seems a bit hack-ish, but `basename` works differently
  2. translate-container-name = $$(if docker container inspect $(1) > /dev/null 2>&1; then echo $(1); else echo $(1) | sed 'y/_/-/' ; fi)
  3. args = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}`
  4. %:
  5. @:
  6. .PHONY:
  7. @if ! docker info > /dev/null; then echo "Docker does not seem to be running"; exit 1; fi
  8. up: .PHONY
  9. docker-compose up -d
  10. down: .PHONY
  11. docker-compose down
  12. redis-shell:
  13. docker exec -it $(call translate-container-name,$(strip $(DIR))_redis_1) sh -c 'redis-cli'
  14. php-repl: .PHONY
  15. docker exec -it $(call translate-container-name,$(strip $(DIR))_php_1) sh -c '/var/www/social/bin/console psysh'
  16. php-shell: .PHONY
  17. docker exec -it $(call translate-container-name,$(strip $(DIR))_php_1) sh -c 'cd /var/www/social; sh'
  18. psql-shell: .PHONY
  19. docker exec -it $(call translate-container-name,$(strip $(DIR))_db_1) sh -c "psql -U postgres social"
  20. database-force-nuke:
  21. docker stop $(call translate-container-name,$(strip $(DIR))_worker_1) \
  22. && docker exec -it $(call translate-container-name,$(strip $(DIR))_php_1) sh -c "cd /var/www/social; bin/console doctrine:database:drop --force && bin/console doctrine:database:create && bin/console doctrine:schema:update --dump-sql --force && bin/console app:populate_initial_values" \
  23. && docker-compose up -d
  24. database-force-schema-update:
  25. docker exec -it $(call translate-container-name,$(strip $(DIR))_php_1) sh -c "/var/www/social/bin/console doctrine:schema:update --dump-sql --force"
  26. tooling-docker: .PHONY
  27. @cd docker/tooling && docker-compose up -d --build > /dev/null 2>&1
  28. stop-tooling: .PHONY
  29. cd docker/tooling && docker-compose down
  30. tooling-php-shell: tooling-docker
  31. docker exec -it $(call translate-container-name,tooling_php_1) sh
  32. test-accesibility: tooling-docker
  33. cd docker/tooling && docker-compose run pa11y /accessibility.sh
  34. test: tooling-docker
  35. docker exec $(call translate-container-name,tooling_php_1) /var/tooling/coverage.sh $(call args,'')
  36. cs-fixer: tooling-docker
  37. @bin/php-cs-fixer $${CS_FIXER_FILE}
  38. doc-check: tooling-docker
  39. bin/php-doc-check
  40. phpstan: tooling-docker
  41. bin/phpstan
  42. remove-var:
  43. rm -rf var/*
  44. remove-file:
  45. sudo rm -rf file/*
  46. flush-redis-cache:
  47. docker exec -it $(call translate-container-name,$(strip $(DIR))_redis_1) sh -c 'redis-cli flushall'
  48. force-nuke-everything: down up flush-redis-cache database-force-nuke remove-var remove-file