version: '3.9'

services:
    wordpress:
        image: bjaskulski/wordpress:6.2-beta.1
        extra_hosts:
            - "host.docker.internal:host-gateway"
        init: true
        ports:
            - target: 80
              published: ${HTTP_PORT:-80}
              protocol: tcp
        environment:
            WORDPRESS_DB_HOST: mysql
            WORDPRESS_DB_USER: db
            WORDPRESS_DB_PASSWORD: db
            WORDPRESS_DB_NAME: db
            WORDPRESS_DEBUG: 1
            WORDPRESS_CONFIG_EXTRA: |
                define("WP_DEBUG_LOG", "/dev/stderr");
                define("SCRIPT_DEBUG", true);
                define("WP_DEFAULT_THEME", "storefront");
                define("ALTERNATE_WP_CRON", true);
                define("WP_ENVIRONMENT_TYPE", 'development');
            XDEBUG_MODE: ${XDEBUG_MODE:-off}
            MH_SENDMAIL_SMTP_ADDR: "mailer:1025"
        volumes:
            - .:/var/www/html/wp-content/plugins/flexible-subscriptions
            - /home/bjaskulski/Repos/github.com/bart-jaskulski/wps:/var/www/html/wp-content/plugins/wps

    mysql:
        image: mysql:5.7
        init: true
        environment:
            MYSQL_DATABASE: db
            MYSQL_USER: db
            MYSQL_PASSWORD: db
            MYSQL_RANDOM_ROOT_PASSWORD: 1
        volumes:
            - db:/var/lib/mysql

    mailer:
        image: mailhog/mailhog
        ports:
            - "8025:8025"

volumes:
    db:
