Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ./docker-compose.yml
- version: '3'
- services:
- #PHP Service
- php:
- image: php-dockerfile
- build:
- context: ./
- dockerfile: ./Dockerfile
- target: php-dockerfile
- container_name: php
- restart: unless-stopped
- env_file: .env
- environment:
- - WORDPRESS_DB_HOST=db:3306
- - WORDPRESS_DB_USER=$MYSQL_USER
- - WORDPRESS_DB_PASSWORD=$MYSQL_PASSWORD
- - WORDPRESS_DB_NAME=wordpress
- - VIRTUAL_HOST=blog.example.com
- volumes:
- - wordpress:/var/www/html
- working_dir: /var/www
- networks:
- - net
- #MySQL Service
- db:
- depends_on:
- - php
- image: mysql-dockerfile
- build:
- context: ./
- dockerfile: ./Dockerfile
- target: mysql-dockerfile
- container_name: db
- restart: unless-stopped
- env_file: .env
- environment:
- - MYSQL_DATABASE=wordpress
- volumes:
- - dbdata:/var/lib/mysql
- command: '--default-authentication-plugin=mysql_native_password'
- networks:
- - net
- #Nginx Service
- webserver:
- depends_on:
- - db
- image: nginx-dockerfile
- build:
- context: ./
- dockerfile: ./Dockerfile
- target: nginx-dockerfile
- container_name: webserver
- restart: unless-stopped
- expose:
- - 80
- - 443
- volumes:
- - wordpress:/var/www/html
- - vhostd:/etc/nginx/vhost.d
- labels:
- - "traefik.frontend.rule=HostRegexp:{subdomain:[a-z]+}.domain.com"
- networks:
- - net
- volumes:
- wordpress:
- dbdata:
- vhostd:
- networks:
- net:
- external: true
Add Comment
Please, Sign In to add comment