services:
  odoo:
    build: .
    container_name: odoo-go
    depends_on:
      db:
        condition: service_healthy
    ports:
      - "8069:8069"
    environment:
      HOST: db
      USER: odoo
      PASSWORD: odoo
      ODOO_DB_NAME: odoo
      ODOO_FRONTEND_DIR: /app/frontend
      ODOO_BUILD_DIR: /app/build
    restart: unless-stopped

  db:
    image: postgres:16-alpine
    container_name: odoo-go-db
    environment:
      POSTGRES_USER: odoo
      POSTGRES_PASSWORD: odoo
      POSTGRES_DB: odoo
    volumes:
      - db-data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U odoo -d odoo"]
      interval: 5s
      timeout: 5s
      retries: 5
    restart: unless-stopped

volumes:
  db-data:
