version: "3.5"

services:
  wp:
   # image: authldap:latest
    build:
      context: dockersetup
      dockerfile: Dockerfile_wordpress
    ports:
      - 80:80 # change ip if required
    volumes:
      - ./config/php.conf.ini:/usr/local/etc/php/conf.d/conf.ini
      - ./wp-app:/var/www/html # Full wordpress project
      - .:/var/www/html/wp-content/plugins/authldap # Plugin development
      #- ./theme-name/trunk/:/var/www/html/wp-content/themes/theme-name # Theme development
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_NAME: "wordpress"
      WORDPRESS_DB_USER: root
      WORDPRESS_DB_PASSWORD: "wppasswd"
    depends_on:
      - db
    links:
      - db

  wpcli:
    image: wordpress:cli
    volumes:
      - ./config/php.conf.ini:/usr/local/etc/php/conf.d/conf.ini
      - ./wp-app:/var/www/html
    depends_on:
      - db
      - wp

  db:
    image: mysql:latest # https://hub.docker.com/_/mysql/ - or mariadb https://hub.docker.com/_/mariadb
    ports:
      - 3306:3306 # change ip if required
    command: [
      '--default_authentication_plugin=mysql_native_password',
      '--character-set-server=utf8mb4',
      '--collation-server=utf8mb4_unicode_ci'
    ]
    volumes:
      - ./wp-data:/docker-entrypoint-initdb.d
      - db_data:/var/lib/mysql
    environment:
      MYSQL_DATABASE: "wordpress"
      MYSQL_ROOT_PASSWORD: "wppasswd"

  openldap:
    image: osixia/openldap:latest
#    build:
#      context: dockersetup
#      dockerfile: Dockerfile_ldap
    ports:
      - 389:389
    volumes:
      - ./.ci/50-init.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/50-bootstrap.ldif
    command: "--copy-service --loglevel debug"
    restart: always
    environment:
      LDAP_LOG_LEVEL: "0"
      LDAP_TLS: "false"

volumes:
  db_data: