name: liferay-stack
services:
    database:
        command: >
            mysqld
            --character-set-server=utf8mb4
            --collation-server=utf8mb4_general_ci
            --innodb-buffer-pool-size=512M
            --innodb-doublewrite=OFF
            --innodb-flush-log-at-trx-commit=2
            --innodb-flush-method=O_DIRECT
            --lower_case_table_names=1
            --sync-binlog=0
        container_name: database
        environment:
            MYSQL_ALLOW_EMPTY_PASSWORD: 1
            MYSQL_DATABASE: lportal
        healthcheck:
            interval: 5s
            retries: 10
            start_period: 5m
            test: ["CMD", "mysqladmin", "ping", "--host", "localhost"]
            timeout: 20s
        image: mysql:8.0
        ports:
            -   3306:3306
    liferay:
        container_name: liferay
        depends_on:
            database:
                condition: service_healthy
        environment:
            LIFERAY_DISABLE_TRIAL_LICENSE: "true"
            LIFERAY_JPDA_ENABLED: "true"
            LIFERAY_JVM_OPTS: -XX:MaxMetaspaceSize=1g -XX:MaxNewSize=2g -XX:MetaspaceSize=768m -XX:NewSize=2g -XX:SurvivorRatio=7 -Xms8g -Xmx8g
            LIFERAY_WORKSPACE_ENVIRONMENT: local
        healthcheck:
            interval: 10s
            retries: 60
            start_period: 40s
            test: ["CMD", "curl", "--fail", "--silent", "http://localhost:8080/c/portal/status"]
            timeout: 10s
        image: liferay:local
        mem_limit: 10g
        mem_reservation: 8g
        ports:
            -   80:8080
            -   8000:8000
            -   8080:8080
            -   11311:11311
            -   58081:58081
        volumes:
            -   liferay_data:/opt/liferay/data
            -   liferay_routes:/opt/liferay/routes
volumes:
    liferay_data:
    liferay_routes: