Skip to content

Instantly share code, notes, and snippets.

@SreejithEzhakkad
Last active July 14, 2019 13:59
Show Gist options
  • Save SreejithEzhakkad/162bbc87c660f3b4462009d530b937e6 to your computer and use it in GitHub Desktop.
Save SreejithEzhakkad/162bbc87c660f3b4462009d530b937e6 to your computer and use it in GitHub Desktop.
Docker compose file for Laravel app with NGINX & MySQL without adding the configuration for persisting of data.
version: '3'
services:
#PHP Service
app:
build:
context: .
dockerfile: Dockerfile
image: php:7.3-fpm
container_name: app
restart: unless-stopped
tty: true
environment:
SERVICE_NAME: app
SERVICE_TAGS: dev
working_dir: /var/www
volumes:
- ./:/var/www
- ./php/local.ini:/usr/local/etc/php/conf.d/local.ini
networks:
- app-network
#Nginx Service
webserver:
image: nginx:alpine
container_name: webserver
restart: unless-stopped
tty: true
ports:
- "8080:80"
- "8443:443"
volumes:
- ./:/var/www
- ./nginx/conf.d/:/etc/nginx/conf.d/
networks:
- app-network
#MySQL Service
db:
image: mysql:5.7.24
container_name: db
restart: unless-stopped
tty: true
ports:
- "33061:3306"
environment:
MYSQL_DATABASE: laravel
MYSQL_ROOT_PASSWORD: root
SERVICE_TAGS: dev
SERVICE_NAME: mysql
volumes:
- dbdata:/var/lib/mysql/
- ./mysql/my.cnf:/etc/mysql/my.cnf
networks:
- app-network
#Docker Networks
networks:
app-network:
driver: bridge
#Volumes
volumes:
dbdata:
driver: local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment