Alpine Docker image for Laravel applications
386
This is a docker image based on the PHP7 FPM alpine image that is able to serve Laravel applications.
To run the docker image simply run the following command (change volumes and ports to fit your environment)
docker run -itd -p 8080:80 -v /path/to/local/laravel:/var/www/html thimico/laravel
After this your Laravel application should be available at http://localhost:8080
This sections explains how to customize this docker image to fit your needs. There are a few ways to customize this docker image. This can be done through changing the Dockerfile in this repository and rebuilding the image or extending from the image itself. In all examples below I will be extending the image.
By default xdebug is enabled, to disable it you need to create a .env file which should contain the following variables, but remember to change the value based one what you want to achieve:
PHP_XDEBUG_REMOTE_HOST=127.0.0.1
PHP_XDEBUG_REMOTE_PORT=9001
Then run the docker and specify the env file that you have created like this
docker run -itd --env-file .env -v /path/to/local/laravel:/var/www/html -p 80:80 thimico/laravel
docker run --name orea -itd -p 80:80 -e PHP_XDEBUG_REMOTE_HOST=192.168.1.110 -e PHP_XDEBUG_REMOTE_PORT=9000 -v /Users/thimico/ambiente/orea/laravel_project/orea/:/var/www/html thimico/laravel
To install additional PHP extensions run the docker-php-ext-install command. You may need to install dependencies before installing the extension based on the extension that will be installed.
FROM thimico/laravel
RUN docker-php-ext-install simplexml
To change the nginx configuration edit the nginx.conf to your needs, after that edit your Dockerfile to replace the default configuration
FROM thimico/laravel
COPY nginx.conf /etc/nginx/nginx.conf
To change the supervisor configuration edit the supervisord.conf file to your needs, after that edit your Dockerfile to replace the default configuration
FROM thimico/laravel
COPY supervisord.conf /etc/supervisord.conf
Feel free to open an issue in this repository or contact me on Twitter. Contributions are also more than welcome.
Content type
Image
Digest
Size
142 MB
Last updated
almost 8 years ago
docker pull thimico/laravel