This is my docker image for Laravel Applications, utilising docker-compose. If you have any feedback or suggestions please feel to make a pull request or leave a comment below.
- Clone the GitHub repo
- In the top level and in the
.envand configure your credentials.
.env.exampleis included in two places, one for docker-compose to read and the other for Laravel to read.
- Clone the latest Laravel into your src folder
Run the following in a terminal where docker-compose files are located.
docker-compose -f docker-compose-dev.yml build app docker-compose -f docker-compose-dev.yml up -d docker-compose -f docker-compose-dev.yml exec app ./install.sh
Run the following in a terminal:
docker-compose build app docker-compose up -d docker-compose exec app ./install.sh
- Make sure
DB_CONNECTION=mysqlequals your service name in your docker-compose for
- To run commands, use docker-compose exec, or enter the docker container:
docker-compose exec app php artisan config:clear
- The install script run at the end includes a list of post production actions Laravel suggests in their documentation to carry out, you can read more on those here.
#!/bin/bash composer install --optimize-autoloader --no-dev php artisan config:cache php artisan route:cache php artisan view:cache php artisan key:generate