Docker definition for Laravel Development.
This is an attempt to make development using docker simple by having most of the needed stuff inside the php container.
This image is now based on alpine linux and has extensions for SQLite, MySQL, MariaDB and Postgresql
Xdebug is also installed
##Build
The simplest way to use this Docker definition is to build the image:
docker build .
You can also build the image and include a tag to make it easier to find like so:
docker build -t <dockhubname>/php-fpm-laravel:latest .
##Use The best way to use this image is with other images.
As it does not have a webserver nor a database server, use it as part of a group. Check the docker-compose.yml in this repository. The necessary mysql drivers are installed. But if you are planning in using anything else please feel free to fork and change.
When running composer or php artisan you need to do it from the php container. You can go to the container by: docker exec -ti appnamephp /bin/bash
Once inside the container, you can run composer by php /usr/local/bin/composer
You can also run this without being in the container's terminal by running composer or artisan like so: docker exec appnamephp php /usr/local/bin/composer
or docker exec appnamephp php artisan
One thing that you need to be aware is that whenever you run any of those commands, you need to run sudo chmod -R yourusername:yourusername ./src/*
.
The reason for this is that when inside the container the commands are run as root and therefore owned by root.
Hope this helps you setup a development environment faster.
###xdebug
To enable xdebug please mount a volume that points to /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini