Makefile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 > /dev/null 2>&1
  28. accessibility: .PHONY
  29. @cd docker/accessibility && docker-compose up
  30. test: tooling-docker
  31. docker exec $(call translate-container-name,tooling_php_1) /var/tooling/coverage.sh $(call args,'')
  32. doc-check:
  33. bin/php-doc-check src components plugins
  34. phpstan: tooling-docker
  35. bin/phpstan
  36. stop-tooling: .PHONY
  37. cd docker/tooling && docker-compose down
  38. remove-var:
  39. rm -rf var/*
  40. flush-redis-cache:
  41. docker exec -it $(call translate-container-name,$(strip $(DIR))_redis_1) sh -c 'redis-cli flushall'
  42. force-nuke-everything: remove-var flush-redis-cache database-force-nuke