services:
    db:
        image: postgres:15
        environment:
            POSTGRES_DB: odoo
            POSTGRES_PASSWORD: odoo
            POSTGRES_USER: odoo
        # ports:
        #   - "5432:5432"
        volumes:
            - postgres_data_addons_cm:/var/lib/postgresql/data
        healthcheck:
            test: ["CMD-SHELL", "pg_isready -U odoo"]
            interval: 5s
            timeout: 5s
            retries: 5

    odoo:
        image: odoo:18
        depends_on:
            db:
                condition: service_healthy
        ports:
            - "8069:8069"
            - "8072:8072"
        environment:
            HOST: 0.0.0.0
            PORT: "8069"
        volumes:
            - ./:/mnt/extra-addons/
            - ./odoo.conf:/etc/odoo/odoo.conf:ro
            - odoo_data_addons_cm:/var/lib/odoo
        command: odoo -c /etc/odoo/odoo.conf

volumes:
    postgres_data_addons_cm:
    odoo_data_addons_cm:
