--- # One-shot init service: creates and initializes the Odoo database and installs # the `base` module on first start. It waits for Postgres and will exit after # successful initialization. services: odoo: depends_on: odoo-init: condition: service_completed_successfully odoo-init: image: odoo:19 container_name: odoo-init restart: "no" # Run the wrapper as root so it can chown volumes. The wrapper will drop to # the 'odoo' user before executing the init script. user: "0:0" volumes: - odoo-db-data:/var/lib/odoo - odoo-config:/etc/odoo - ./scripts/odoo/init-odoo.sh:/init-odoo.sh - ./scripts/odoo/init-wrapper.sh:/init-wrapper.sh:ro # Use a small wrapper script (mounted from host) to fix permissions, then run init entrypoint: ["/bin/sh","/init-wrapper.sh"] command: [] environment: - HOST=${ODOO_DB_HOST} - USER=${ODOO_DB_USER} - PASSWORD=${ODOO_DB_PASSWORD} - DB_NAME=${ODOO_DB} volumes: odoo-db-data: odoo-config: