Skip to content

Instantly share code, notes, and snippets.

@yuklia
Created October 19, 2017 13:05
Show Gist options
  • Save yuklia/7c4163213b89ccdfb85bc6d7b614b9f7 to your computer and use it in GitHub Desktop.
Save yuklia/7c4163213b89ccdfb85bc6d7b614b9f7 to your computer and use it in GitHub Desktop.
Dockerize Laravel with related services: mysql, nginx, php-fpm
version: "3"
services:
db:
image: mysql
environment:
- MYSQL_ROOT_PASSWORD=np2Kmh5g
- MYSQL_DATABASE=lara_play
ports:
- "3311:3306"
volumes:
- mysqldata:/var/lib/mysql
- ./db/custom.cnf:/etc/mysql/conf.d/custom.cnf
- ./db/mysql-slow.log:/var/log/mysql/mysql-slow.log
php:
build: ./php
hostname: phpfpm
volumes:
- ./../:/var/www
environment:
- XDEBUG_CONFIG=remote_host=10.254.254.254
- PHP_IDE_CONFIG=serverName=lara.play # for console debugging
links:
- db
nginx:
image: nginx
volumes:
- ./nginx/prx.conf:/prx.conf
- ./../:/var/www
ports:
- "8089:80"
environment:
- NGINX_HOST=lara.play
- NGINX_PORT=80
command: /bin/bash -c "envsubst '$$NGINX_HOST $$NGINX_PORT' < /prx.conf > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
links:
- php
volumes:
mysqldata:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment