version: '3.9'

services:
    app:
        build:
            context: .
            dockerfile: Dockerfile
        container_name: php_app
        ports:
            - "8080:80" # Map port 80 in the container to port 8080 on the host
        volumes:
            - .:/var/www/html # Mount the current directory to the container
            - ./logs:/var/log/apache2 # Mount logs to be accessible on the host
        environment:
            # Pass environment variables for the application
            DEBUG: true
            USE_ENV: true
            CONFIG_TIMEZONE: "Europe/Copenhagen" # Set the timezone
            # Database configuration
            CONFIG_DB_HOST: db
            CONFIG_DB_USER: root
            CONFIG_DB_PASSWORD: example_password
            CONFIG_DB_DATABASE: example_db
            # Security configuration
            ENCRYPTION_KEY: "" # Set the encryption key
            CORS: "*"
            # Economic API credentials
            ECONOMIC_API_APP_ACCESS_GRANT: "" # Economic API access grant token (1)
            ECONOMIC_API_APP_ACCESS_GRANT2: "" # Economic API access grant token (2)
            ECONOMIC_API_APP_SECRET_TOKEN: "" # Economic API secret token
            # WordPress configuration
            WORDPRESS_API_URL: "" # WordPress API URL (e.g. https://www.example.com/wp-admin/admin-ajax.php)
            WORDPRESS_STATIC_TOKEN: "" # WordPress static token for authentication
            EMAIL_WASH_CERTIFICATE_TOKEN: "" # Email wash certificate token
            # MINIO configuration
            MINIO_ENDPOINT: "" # Minio endpoint (e.g. http://localhost:9000)
            MINIO_ACCESS_KEY: "" # Minio access key
            MINIO_SECRET_KEY: "" # Minio secret key
            # Redis configuration
            REDIS_CONFIG_HOST: redis
            REDIS_CONFIG_DATABASE: 0
            REDIS_CONFIG_PASSWORD: ""

            # Slack configuration
            SLACK_DEFAULT_WEBHOOK: "" # Slack default webhook URL
        depends_on:
            - db
            - redis

    db:
        image: mysql:8.0
        container_name: mysql
        ports:
            - "3306:3306" # Map MySQL container's port 3306 to the host
        volumes:
            - db_data:/var/lib/mysql # Persist database data
        environment:
            MYSQL_ROOT_PASSWORD: example_password
            MYSQL_DATABASE: example_db
            MYSQL_USER: app_user
            MYSQL_PASSWORD: app_password

    redis:
        image: redis:6.2
        container_name: redis
        ports:
            - "6379:6379" # Map Redis container's port 6379 to the host
        volumes:
            - redis_data:/data # Persist Redis data

volumes:
    db_data: # Persistent data for MySQL
    redis_data: # Persistent data for Redis