version: '2'

services:
  etherpad:
    build: ./etherpad
    restart: always
    container_name: etherpad
    hostname: etherpad
    entrypoint:
      - /bin/bash
      - /etherpad/entrypoint.sh
    volumes:
      - ./etherpad/entrypoint.sh:/etherpad/entrypoint.sh:ro
      - ./etherpad/settings.json:/etherpad/settings.json:ro
      - ./etherpad/var:/etherpad/var
    expose:
      - 9001
    depends_on:
      - mysql-etherpad
    networks:
      mynet:
        ipv4_address: 172.112.0.101
        
  mysql-etherpad:
    image: mysql:5.7
    container_name: mysql-etherpad
    hostname: mysql-etherpad
    restart: always
    command: ["mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--default-time-zone=+00:00","--explicit_defaults_for_timestamp", "--default-authentication-plugin=mysql_native_password"]
    expose:
      - 3306
    environment:
      - "MYSQL_ROOT_PASSWORD=r00t"
      - "MYSQL_DATABASE=etherpad"
      - "MYSQL_USER=etherpad"
      - "MYSQL_PASSWORD=3th3rp4d."
    volumes:
      - ./mysql:/var/lib/mysql
    networks:
      mynet:
        ipv4_address: 172.112.0.102

networks:
  mynet:
    driver: bridge
    ipam:
      config:
      - subnet: 172.112.0.0/24

