version: '3.7'

services:

  mysql:
    image: mysql:5
    volumes:
      - mysql:/var/lib/mysql
    restart: always
    environment:
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: password
      MYSQL_ROOT_PASSWORD: password

  init:
    image: neuranest-wp-cms/wordpress:latest
    init: true
    volumes:
      - wordpress:/var/www/html
      - .:/var/www/html/wp-content:delegated
    user: "www-data"
    environment:
      WORDPRESS_DEBUG: 1
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: password
      WORDPRESS_DB_HOST: mysql
      WORDPRESS_DB_NAME: wordpress
    entrypoint:
      - "vip-entrypoint.sh"
    links:
      - mysql
    depends_on:
      - mysql
      - wordpress

  wordpress:
    image: neuranest-wp-cms/wordpress:latest
    build:
      context: .
      dockerfile: docker/Dockerfile
    depends_on:
      - mysql
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./:/var/www/html/wp-content:delegated
      - wordpress:/var/www/html/
      - ./docker/mongodb.ini:/usr/local/etc/php/conf.d/mongodb.ini
    restart: always
    environment:
      WORDPRESS_DEBUG: 1
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: password

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    restart: always
    depends_on:
      - mysql
    ports:
      - "8080:80"
    environment:
      PMA_HOST: mysql
      MYSQL_ROOT_PASSWORD: ""
      MYSQL_USERNAME: "root"
      UPLOAD_LIMIT: 30000M
      MEMORY_LIMIT: 30000M
      MAX_EXECUTION_TIME: 20000

  mailhog:
    image: mailhog/mailhog
    ports:
      - "1025:1025"
      - "8025:8025"
  mongo:
    image: mongo:4
    restart: always
    platform: linux/amd64
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: password

  mongo-express:
    image: mongo-express
    platform: linux/amd64
    restart: always
    ports:
      - "8081:8081"
    environment:
      ME_CONFIG_BASICAUTH_PASSWORD: rootpassword
      ME_CONFIG_BASICAUTH_USERNAME: root
      ME_CONFIG_MONGODB_ADMINUSERNAME: root
      ME_CONFIG_MONGODB_ADMINPASSWORD: password
      ME_CONFIG_MONGODB_URL: mongodb://root:password@mongo:27017/

volumes:
  mysql: {}
  wordpress: {}
