Last active
November 10, 2023 20:10
-
-
Save dgoosens/a5866ba4ccc5098c4410fd638f6c1dae to your computer and use it in GitHub Desktop.
FrankenPHP- APIPlatform Makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DOCKER_COMPOSE=docker compose | |
| .DEFAULT_GOAL := help | |
| ##help: List available tasks on this project | |
| help: | |
| @echo "" | |
| @echo "These are the available commands" | |
| @echo "" | |
| @grep -E '\#\#[a-zA-Z\.\-]+:.*$$' $(MAKEFILE_LIST) \ | |
| | tr -d '##' \ | |
| | awk 'BEGIN {FS = ": "}; {printf " \033[36m%-30s\033[0m %s\n", $$1, $$2}' \ | |
| ##build: Build all docker images | |
| build: | |
| $(DOCKER_COMPOSE) build --no-cache | |
| .PHONY: build | |
| ##start: Start containers and make sure they are ready | |
| start: | |
| $(DOCKER_COMPOSE) up --pull --wait -d | |
| .PHONY: start | |
| ##stop: Kill all containers | |
| stop: | |
| $(DOCKER_COMPOSE) kill | |
| .PHONY: stop | |
| ##clean: Remove all containers with their volumes | |
| clean: | |
| $(DOCKER_COMPOSE) down -v --remove-orphans || true | |
| .PHONY: clean | |
| ##logs: tail PHP container logs | |
| logs: | |
| $(DOCKER_COMPOSE) logs -f | |
| .PHONY: logs | |
| ##bash: access the PHP container's bash | |
| bash: | |
| $(DOCKER_COMPOSE) exec php sh -l | |
| .PHONY: bash | |
| ##composer: run composer commands [use `--` if multiple arguments] | |
| composer: | |
| $(DOCKER_COMPOSE) exec php composer $(filter-out $@,$(MAKECMDGOALS)) | |
| .PHONY: composer | |
| ##console: run symfony's console commands [use `--` if multiple arguments] | |
| console: | |
| $(DOCKER_COMPOSE) exec php bin/console $(filter-out $@,$(MAKECMDGOALS)) | |
| .PHONY: console | |
| ##vbin: run any `bin` script, with arguments, located in your `vendor/bin` [use `--` after the binary] | |
| vbin: | |
| $(DOCKER_COMPOSE) exec php vendor/bin/$(filter-out $@,$(MAKECMDGOALS)) | |
| .PHONY: vbin |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very basic list of
makecommands that can be used within FrankenPHP/APIPlatform projectsOr any project based on Symfony running within a Docker container...
Run
make helpto get the list of commandsmake consolewill list all the Symfony Console commands...and you just need to append those commands
for instance
make composerwill do the same for composerfor instance
(do remember to add
--if there is more than one argument for both themake consoleandmake composercommandsUPDATE 2023-11-03
added the
vbincommandthis allows to run any script located in the
vendor/bindirectorycomes in handy to run things like
phpunitorphpstan