Skip to content

Instantly share code, notes, and snippets.

@i3inary
Created March 31, 2020 19:04
Show Gist options
  • Select an option

  • Save i3inary/4514d1ae77e6a833effbaf1a909a48e5 to your computer and use it in GitHub Desktop.

Select an option

Save i3inary/4514d1ae77e6a833effbaf1a909a48e5 to your computer and use it in GitHub Desktop.

Revisions

  1. i3inary created this gist Mar 31, 2020.
    66 changes: 66 additions & 0 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,66 @@
    version: '3'

    services:
    db:
    image: mysql:8.0
    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:
    - app-network

    wordpress:
    depends_on:
    - db
    image: wordpress:5.1.1-fpm-alpine
    container_name: wordpress
    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
    volumes:
    - wordpress:/var/www/html
    networks:
    - app-network

    webserver:
    depends_on:
    - wordpress
    image: nginx:1.15.12-alpine
    container_name: webserver
    restart: unless-stopped
    ports:
    - "80:80"
    volumes:
    - wordpress:/var/www/html
    - ./nginx-conf:/etc/nginx/conf.d
    - certbot-etc:/etc/letsencrypt
    networks:
    - app-network

    certbot:
    depends_on:
    - webserver
    image: certbot/certbot
    container_name: certbot
    volumes:
    - certbot-etc:/etc/letsencrypt
    - wordpress:/var/www/html
    command: certonly --webroot --webroot-path=/var/www/html --email [email protected] --agree-tos --no-eff-email --staging -d example.com -d www.example.com

    volumes:
    certbot-etc:
    wordpress:
    dbdata:

    networks:
    app-network:
    driver: bridge