Container for a Laravel project, generated.
224
A script for building Dockerfile and docker-compose.yml based on Laravel project requirements.
Checkout the repository:
git clone https://github.com/datashaman/docker-laravel.git
cd docker-laravel
Generate Dockerfile and docker-compose.yml with:
./build.sh php7.2 beanstalkd mailhog memcached mariadb elasticsearch redis
Copy the following into your project folder:
If you want to put the templates somewhere else, adjust the paths in Dockerfile and docker-compose.yml.
The php-fpm.conf file is needed at build time (and maybe also runtime), and the nginx.conf file is needed at runtime.
Edit your current .env file and remove any references to hostnames of services you've just added.
For example, DB_HOST, ELASTICSEARCH_HOST, MEMCACHED_HOST, REDIS_HOST. These will be configured inside the Compose stack.
Remove any mail-related variables as well, mailhog will handle that.
Bring the Compose stack up:
docker-compose up
Once it's pulled and built everything see which ports are open:
docker-compose ps
The stack exposes the following HTTP endpoints:
The app uses the PHP-FPM binary, but can also be used for CLI usage. Do something like this to run your migrations and setup up your instance's data:
Typing that all the time is a PITA, so setup an alias in your .bashrc or similar:
alias dcra='docker-compose run app'
And use it like this:
dcra composer install
dcra php artisan migrate --seed
Services available in the stack:
The sample Dockerfile and docker-compose.yml files in this repo build all the above (using mariadb as db).
Content type
Image
Digest
Size
212.7 MB
Last updated
over 7 years ago
docker pull datashaman/docker-laravel