services:
  db:
    image: postgres:16
    environment:
      POSTGRES_DB: postgres
      POSTGRES_USER: odoo
      POSTGRES_PASSWORD: 0d00S3cur3P@ss!
    volumes:
      - ./postgres-data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U odoo"]
      interval: 10s
      timeout: 5s
      retries: 5

  odoo:
    image: odoo:17.0
    depends_on:
      db:
        condition: service_healthy
    ports:
      - "8070:8069"
    environment:
      HOST: db
      USER: odoo
      PASSWORD: 0d00S3cur3P@ss!
    volumes:
      - ./odoo-data/addons:/mnt/extra-addons
      - ./odoo-data/filestore:/var/lib/odoo/filestore
      - ./odoo-data/sessions:/var/lib/odoo/sessions
    user: "101:101"
    restart: unless-stopped
