Last active
January 7, 2021 22:07
-
-
Save tur0o/813548b28142da10d95629b1aff18740 to your computer and use it in GitHub Desktop.
Makefile to init a dockerized symfony project
This file contains 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
.PHONY: help project-init docker-build docker-up install-vendors jwt-init db-init hello | |
.DEFAULT_GOAL = help | |
project-init: docker-build docker-up install-vendors jwt-init db-init hello ## Install and init project | |
docker-build: ## Build docker image | |
docker-compose build | |
docker-up: ## Run containers | |
docker-compose up -d | |
install-vendors: ## Install vendors | |
docker-compose exec app bash -c 'composer install' | |
jwt-init: ## Create the JWT files | |
docker-compose exec app bash -c 'mkdir -p config/jwt' | |
docker-compose exec app bash -c 'openssl genpkey -out config/jwt/private.pem -aes256 -algorithm rsa -pkeyopt rsa_keygen_bits:4096 -pass pass:azerty' | |
docker-compose exec app bash -c 'openssl pkey -in config/jwt/private.pem -out config/jwt/public.pem -pubout -passin pass:azerty' | |
db-init: ## Init database | |
@#docker-compose exec app bash -c 'php bin/console doctrine:migrations:migrate' | |
docker-compose exec app bash -c 'php bin/console doctrine:database:create --if-not-exists' | |
docker-compose exec app bash -c 'php bin/console doctrine:schema:update --force' | |
docker-compose exec app bash -c 'php bin/console hautelook:fixtures:load --no-interaction' | |
hello: ## Print the welcome message | |
@printf "\n\n" | |
@printf "================\n" | |
@printf " APP IS READY \n" | |
@printf "================\n" | |
@printf "\n" | |
@printf "1. Go to : http://app.local:8000" | |
@printf "\n" | |
@printf "2. And login with : user@user.com / password" | |
@printf "\n\n" | |
@echo "Enjoy!" | |
@printf "\n\n" | |
help: | |
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-20s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment