[IMP] docker-compose: host paths in .env, override merged in

The OCA sources living outside this repo were mounted from a hardcoded
/media/snt/data/odoo in a local, untracked docker-compose.override.yml.
The host root now comes from ODOO_SRC in .env (gitignored, .env.example
added), so the mounts can live in docker-compose.yml itself and be shared.

Also parameterized: the published ports (ODOO_HTTP_PORT /
ODOO_LONGPOLLING_PORT) and the in-container addons path
(ODOO_ADDONS_PATH), the latter being the single source of truth for the
`command` and for manual `docker-compose run odoo odoo ...` invocations.

Missing variables fail with an explicit message instead of mounting empty
paths. `docker-compose config` resolves exactly as before.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
GitHub Copilot 2026-08-17 13:57:25 +02:00
parent b3999e2283
commit 3eb79e2431
4 changed files with 55 additions and 7 deletions

22
.env.example Normal file
View file

@ -0,0 +1,22 @@
# Local environment for docker-compose. Copy to `.env` and adjust the paths:
#
# cp .env.example .env
#
# `.env` is gitignored: every developer points these at their own checkouts.
# docker-compose reads it automatically. For manual `docker-compose run` calls
# that need $ODOO_ADDONS_PATH in the shell, load it first:
#
# set -a; . ./.env; set +a
# Host directory holding the read-only Odoo/OCA sources (OCB + the OCA repos
# listed in oca_dependencies.txt). Each repo is mounted at /mnt/oca/<repo>.
ODOO_SRC=/media/snt/data/odoo
# Host ports published by the odoo service (web / longpolling).
ODOO_HTTP_PORT=8069
ODOO_LONGPOLLING_PORT=8072
# Addons path *inside* the container. Single source of truth: used by the
# `command` in docker-compose.yml and by manual `docker-compose run`
# invocations (`odoo --addons-path=$ODOO_ADDONS_PATH ...`).
ODOO_ADDONS_PATH=/mnt/extra-addons,/mnt/oca/account-invoice-reporting,/mnt/oca/account-invoicing,/mnt/oca/bank-payment,/mnt/oca/community-data-files,/mnt/oca/l10n-spain,/mnt/oca/pos,/mnt/oca/product-attribute,/mnt/oca/purchase-workflow,/mnt/oca/sale-workflow,/mnt/oca/stock-logistics-workflow,/usr/lib/python3/dist-packages/odoo/addons