This is a php 7.2 image with xdebug, mysql support and composer
version: '3'
services:
api:
image: pegle/laravel:master
container_name: api
ports:
- 80:80
volumes:
- .:/var/www/html
environment:
APACHE_DOCUMENT_ROOT: /var/www/html/public
PHP_IDE_CONFIG: serverName=localhost
MYSQL_SERVICE_HOST: database
command: /bin/bash /var/www/html/docker/laravel/run.sh
links:
- database
database:
image: mysql:5.7
container_name: database
ports:
- 3307:3306
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: laravel
MYSQL_USER: laravel
MYSQL_PASSWORD: laravel
#!/bin/bash
echo "Run Composer install"
composer install
echo "Wait for Database"
until nc -v -w30 ${MYSQL_SERVICE_HOST} 3306
do
echo "Waiting for database connection..."
sleep 5
done
echo "Setup laravel"
cp /var/www/html/.env.example /var/www/html/.env
php artisan migrate --seed
exec /usr/local/bin/apache2-foreground
To give docker a public ip address to connect to the IDE you must set an ip alias.
$ sudo ifconfig lo0 alias 10.254.254.254 255.255.255.05.0
You can use xdebug with php cli. There is an alias in the container named xdebug
$ docker run --rm -v "$PWD":/var/www/html -e PHP_IDE_CONFIG=serverName=localhost pegle/laravel:master xdebug script.php
Content type
Image
Digest
sha256:a08e652d7…
Size
173.8 MB
Last updated
almost 4 years ago
docker pull pegle/laravel:master