better docker installation

This commit is contained in:
Nick Yeoman 2022-11-17 17:10:00 -08:00
parent 46a617f9f4
commit e54e634017
2 changed files with 21 additions and 12 deletions

View File

@ -94,12 +94,22 @@ composer require symfony/security-bundle
composer require form validator composer require form validator
composer require symfonycasts/verify-email-bundle composer require symfonycasts/verify-email-bundle
################################################################################
# Database
################################################################################
composer req -n orm && sleep 1
# TODO: In the future you may want to replace this with code
# ( but not here if you are sharing the script)
# sed -n -e '/^DATABASE_URL/p' .env
################################################################################ ################################################################################
# Docker # Docker
################################################################################ ################################################################################
# For the Apache container # For the Apache container
composer req symfony/apache-pack composer req -n symfony/apache-pack
# You need the following variables in your env for docker-compose # You need the following variables in your env for docker-compose
echo '' >> .env echo '' >> .env
@ -111,7 +121,8 @@ echo 'DOCKERNET=DOCKER_NETWORK_NAME_FOR_PROXY' >> .env
echo "DOCKERPORT=8000" >> .env echo "DOCKERPORT=8000" >> .env
GEN=`echo $RANDOM | md5sum | head -c 12` GEN=`echo $RANDOM | md5sum | head -c 12`
echo "MYSQL_ROOT_PASSWORD=${GEN}" >> .env echo "MYSQL_ROOT_PASSWORD=${GEN}" >> .env
echo 'DOCKERPHPMYADMIN=8001' >> .env
echo '' >> .env
echo '# Database info, should match your db url' >> .env echo '# Database info, should match your db url' >> .env
echo 'DBHOST=mariadb' >> .env echo 'DBHOST=mariadb' >> .env
echo 'DB=symfony_project' >> .env echo 'DB=symfony_project' >> .env
@ -119,24 +130,19 @@ GEN=`echo $RANDOM | md5sum | head -c 4`
echo "DBUSER=theuser${GEN}" >> .env echo "DBUSER=theuser${GEN}" >> .env
GEN=`echo $RANDOM | md5sum | head -c 12` GEN=`echo $RANDOM | md5sum | head -c 12`
echo "DBPASSWORD=${GEN}" >> .env echo "DBPASSWORD=${GEN}" >> .env
echo '' >> .env
echo '# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8&charset=utf8mb4"'
# TODO: move these here after you have symfony production ready # TODO: move these here after you have symfony production ready
rm docker-compose.yml
rm docker-compose.override.yml
echo "Creating a docker-compose" echo "Creating a docker-compose"
wget https://raw.githubusercontent.com/nickyeoman/phpframework/main/docker/docker-compose.yml wget https://raw.githubusercontent.com/nickyeoman/phpframework/main/docker/docker-compose.yml
echo "Creating a Dockerfile" echo "Creating a Dockerfile"
wget https://raw.githubusercontent.com/nickyeoman/phpframework/main/docker/Dockerfile wget https://raw.githubusercontent.com/nickyeoman/phpframework/main/docker/Dockerfile
################################################################################
# Database
################################################################################
composer req -n orm && sleep 1
# TODO: In the future you may want to replace this with code
# ( but not here if you are sharing the script)
# sed -n -e '/^DATABASE_URL/p' .env
################################################################################ ################################################################################
# Git # Git
################################################################################ ################################################################################

3
docs/Docker.md Normal file
View File

@ -0,0 +1,3 @@
# Docker Docs
You should be able to manually parse the docker compose file.