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>
63 lines
2.5 KiB
YAML
63 lines
2.5 KiB
YAML
# Host-specific values (paths, ports) live in `.env` — see `.env.example`:
|
|
#
|
|
# cp .env.example .env
|
|
#
|
|
# Note: `docker-compose run odoo odoo ...` replaces the `command` below, so the
|
|
# addons path has to be repeated there. Load `.env` into the shell first:
|
|
#
|
|
# set -a; . ./.env; set +a
|
|
# docker-compose run --rm odoo odoo -c /etc/odoo/odoo.conf \
|
|
# --addons-path=$ODOO_ADDONS_PATH \
|
|
# -d odoo -u <addon> --test-enable --stop-after-init
|
|
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:
|
|
- "${ODOO_HTTP_PORT:-8069}:8069"
|
|
- "${ODOO_LONGPOLLING_PORT:-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
|
|
# OCA sources living outside this repo (dependencies that are not
|
|
# here: `pos_payment_method_cashdro`, `account_banking_mandate`, ...),
|
|
# mounted read-only from $ODOO_SRC.
|
|
- ${ODOO_SRC:?set ODOO_SRC in .env, see .env.example}/account-invoice-reporting:/mnt/oca/account-invoice-reporting:ro
|
|
- ${ODOO_SRC}/account-invoicing:/mnt/oca/account-invoicing:ro
|
|
- ${ODOO_SRC}/bank-payment:/mnt/oca/bank-payment:ro
|
|
- ${ODOO_SRC}/community-data-files:/mnt/oca/community-data-files:ro
|
|
- ${ODOO_SRC}/l10n-spain:/mnt/oca/l10n-spain:ro
|
|
- ${ODOO_SRC}/pos:/mnt/oca/pos:ro
|
|
- ${ODOO_SRC}/product-attribute:/mnt/oca/product-attribute:ro
|
|
- ${ODOO_SRC}/purchase-workflow:/mnt/oca/purchase-workflow:ro
|
|
- ${ODOO_SRC}/sale-workflow:/mnt/oca/sale-workflow:ro
|
|
- ${ODOO_SRC}/stock-logistics-workflow:/mnt/oca/stock-logistics-workflow:ro
|
|
command: >
|
|
odoo -c /etc/odoo/odoo.conf
|
|
--addons-path=${ODOO_ADDONS_PATH:?set ODOO_ADDONS_PATH in .env, see .env.example}
|
|
|
|
volumes:
|
|
postgres_data_addons_cm:
|
|
odoo_data_addons_cm:
|