Mint System Odoo
A better Odoo image.
This container image is an improvement of the official Odoo image:
- 🐍 The image uses Python version 3.12.
- 📦 Package management is handled with uv for Python and pnpm for Node.
- 🔄 The Odoo source is based on a specific revision.
- 💎 The image build process ensures reproducibility.
- ⚙️ Configuration of
odoo.confis managed through environment variables. - 🌱 Addons are cloned from git repositories.
- 🛠️ Python packages can be installed without rebuilding the image.
- 📂 The system detects addons in nested module folders.
- 💾 Session information can be stored in the database.
- 🖥️ Environment name is retrieved from server configuration.
- 📋 Database initialization with selected modules.
- 📜 The image includes built-in Manifestoo and click-odoo-contrib.
- 🌈 The multiplatform image supports both
amd64andarm64architectures. - 🪴 The container runs without requiring root privileges.
Source: https://github.com/Mint-System/Odoo-Build/tree/main/image/
Usage
The Mint System Odoo image runs with a very basic configuration, but can also be highly customized with environment variables.
Base
The following compose.yml file is a basic setup:
services:
odoo:
container_name: odoo
image: mintsystem/odoo:16.0.20250311
depends_on:
- db
environment:
PGHOST: db
PGUSER: odoo
PGPASSWORD: odoo
PGPORT: 5432
ports:
- "127.0.0.1:8069:8069"
volumes:
- odoo-data:/var/lib/odoo
- ./addons:/mnt/addons
- ./oca:/mnt/oca
- ./enterprise:/mnt/enterprise
- ./themes:/mnt/themes
db:
container_name: db
image: postgres:14-alpine
environment:
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoo
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- db-data:/var/lib/postgresql/data/pgdata
volumes:
odoo-data:
db-data:
Customized
This compose.yml shows all possible configurations:
services:
odoo:
container_name: odoo
image: mintsystem/odoo:16.0.20250311
depends_on:
- db
environment:
PGHOST: db
PGUSER: odoo
PGPASSWORD: odoo
PGPORT: 5432
MAIL_DEFAULT_FROM: test
MAIL_CATCHALL_DOMAIN: mint-system.ch
MAIL_CATCHALL_ALIAS: test@mint-system.ch
ODOO_MAIL_SMTP_HOST: mail.infomaniak.com
ODOO_MAIL_SMTP_PORT: 587
ODOO_MAIL_SMTP_ENCRYPTION: starttls
ODOO_MAIL_SMTP_FROM_FILTER: test@mint-system.ch
ODOO_MAIL_IMAP_HOST: mail.infomaniak.com
ODOO_MAIL_IMAP_PORT: 993
ODOO_MAIL_IMAP_SSL: "True"
ODOO_MAIL_USERNAME: test@mint-system.ch
ODOO_MAIL_PASSWORD: *****
GIT_SSH_PUBLIC_KEY: ssh-ed25519 BBBBC3NzaC1lZDI1NTE5BBBBIDR9Ibi0mATjCyx1EYg594oFkY0rghtgo+pnFHOvAcym Mint-System-Project-MCC@github.com
GIT_SSH_PRIVATE_KEY: LS0tLS1CRUdJTiBPUEVOU1NIIFBSSVZBVEUgS0VZLS0tLQpiM0JsYm5OemFDMXJaWGt0ZGpFQUFBQUFCRzV2Ym1VQUFBQUVibTl1WlFBQUFBQUFBQUFCQUFBQU13QUFBQXR6YzJndFpXClF5TlRVeE9RQUFBQ0EwZlNHNHRKZ0U0d3NzZFJHSU9mZUtCWkdOSzRJYllLUHFaeFJ6cndITXBnQUFBS2k1WkJhRnVXUVcKaFFBQUFBdHpjMmd0WldReU5UVXhPUUFBQUNBMGZTRzR0SmdFNHdzc2RSR0lPZmVLQlpTks0SWJZS1BxWnhSenJ3SE1wZwowQkFnTT0KLS0tLS1FTkQgT1BFTlNTSCBQUklWQVRFIEtFWS0tLS0tCg==
GITHUB_USERNAME: bot-mintsys
GITHUB_PERSONAL_ACCESS_TOKEN: *****
ADDONS_GIT_REPOS: "git@github.com:Mint-System/Odoo-Apps-Server-Tools.git#16.0,git@github.com:OCA/server-tools.git#16.0"
ODOO_ADDONS_PATH: /mnt/addons/,/mnt/oca/,/mnt/enterprise,/mnt/themes/
ODOO_DATABASE: "16.0"
ODOO_INIT_LANG: de_CH
ODOO_INIT_ADDONS: server_environment_ir_config_parameter
ENVIRONMENT: production
PYTHON_INSTALL: prometheus-client
SERVER_WIDE_MODULES: session_db,module_change_auto_install
SESSION_DB_URI: postgres://odoo:odoo@db/16.0
PROXY_MODE: "True"
LOG_LEVEL: debug
LIST_DB: False
ADMIN_PASSWD: *****
DBFILTER: ^%d$
WORKERS: 4
LIMIT_REQUEST: 16384
LIMIT_TIME_CPU: 300
LIMIT_TIME_REAL: 600
MODULE_AUTO_INSTALL_DISABLED: odoo_test_xmlrunner
CLICK_ODOO_UPDATE: True
ports:
- "127.0.0.1:8069:8069"
volumes:
- odoo-data:/var/lib/odoo
- ./addons:/mnt/addons
- ./oca:/mnt/oca
- ./enterprise:/mnt/enterprise
- ./themes:/mnt/themes
db:
container_name: db
image: postgres:14-alpine
environment:
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoo
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- db-data:/var/lib/postgresql/data/pgdata
volumes:
odoo-data:
db-data:
The environment variables are explained in detail further down.
Lifecycle
The Mint System Odoo image has this container lifecycle in mind:
- Initialize: Initialize the database and clone addons.
- Start: The container starts and updates the execution environment.
- Execution: Actions performed while the container is running.
- Analyze: Analyse the current state of the container.
Initialize
Before starting the container you can initalize the database with selected scripts.
Run the git-clone-addons script to clone module repos:
docker compose run --rm odoo git-clone-addons
Run the init-db script to initalize the Odoo database:
docker compose run --rm odoo init-db
The scripts are configurable with environment variables.
Start
Once you start the container the entrypoint.sh script will:
- Run the
set-addons-pathscript to assemble the addons path. - Apply default values to env variables.
- Run the
auto-envsubstscript to template theodoo.conffile. - Run the
python-installscript to install the Python packages. - Wait for the database to be ready.
- Run the
setup-mailscript to update the mail configuration in the database. - Run the
odoo-updatescript to update modules. - Start the Odoo server.
Execution
Once the container is running, you can update modules with this command:
docker exec odoo bash -c "click-odoo-update \$(grep addons_path /etc/odoo/odoo.conf | sed 's/addons_path = /--addons-path=/') -d odoo
This will start a detached Odoo process and updates only the modules that have a different checksum.
Analyze
With the Manifestoo cli you can query the module manifest files.
List all modules:
docker exec odoo manifestoo --select-found list
Environment Variables
The container can be configured with environment variables. This section shows all the variables in detail:
Database Connection
Odoo supports the PostgreSQL database only.
PGHOSTName of the database container.PGUSERDatabase username.PGPASSWORDDatabase user password.PGPORTPostgres server port. Default is5432.
System Parameters
Define Odoo system parameters. Requires server_environment_ir_config_parameter in ODOO_INIT_ADDONS.
MAIL_CATCHALL_ALIAS: Name of the catchall mail adress. Default iscatchall.MAIL_CATCHALL_DOMAIN: Domain name of of the catchall mail addresMAIL_DEFAULT_FROM: From name for outgoing mails. Default isnotification.
Incoming and Outgoing Mail-Server
Define the mail configuration with these env vars:
ODOO_MAIL_SMTP_HOST: If set Odoo sends mails to this host.ODOO_MAIL_SMTP_PORT: SMTP port. Default is587.ODOO_MAIL_SMTP_ENCRYPTION: SMTP encryption type. Default isstarttls.ODOO_MAIL_SMTP_FROM_FILTER: Send mails from this address only. Default is"".ODOO_MAIL_IMAP_HOST: If set Odoo fetches mails from this host.ODOO_MAIL_IMAP_PORT: IMAP port. Default is993.ODOO_MAIL_IMAP_SSL: Enable IMAP SSL. Default isTrue.ODOO_MAIL_USERNAME: Username of the Odoo mailbox.ODOO_MAIL_PASSWORD: Password of the Odoo mailbox.
Module Repos
The image can clone git repositories.
GIT_SSH_PUBLIC_KEYPublic key for SSH connection.GIT_SSH_PRIVATE_KEYBase64 encoded private key for SSH connection:cat ~/.ssh/id_ed2551 | base64 -w0GITHUB_USERNAMEUsername for git clone command with https.GITHUB_PERSONAL_ACCESS_TOKENToken for git clone command with https.ADDONS_GIT_REPOSComma seperated list of git clone urls appended with#and branch name.
You can use https and git urls for ADDONS_GIT_REPOS:
ADDON_GIT_REPO=git@github.com:OCA/server-tools.git#16.0,git@github.com:Mint-System/Odoo-Apps-Server-Tools.gi#16.0
ADDON_GIT_REPO=https://github.com/OCA/server-tools.git#16.0,https://github.com/Mint-System/Odoo-Apps-Server-Tools.gi#16.0
If you use a git url make sure a valid SSH private/public key is defined.
Addons Path
The entrypoint script searches for module folders in the addons path and creates a new addons path.
ODOO_ADDONS_PATHComma seperated list of container paths pointing to addon folders.
Initialize
Set these environment variables for the database init:
ODOO_DATABASEName of the Odoo database. No default is set.ODOO_INIT_LANGLanguage used for database init. Default isen_US.ODOO_INIT_ADDONSProvide comma separated list of modules for database init. Default isweb.
Server Environment
The Odoo server can be configured using these env vars:
ENVIRONMENTProvide an environment name. Can be accessed withconfig.get("environment").PYTHON_INSTALLComma seperated list of python packages.SERVER_WIDE_MODULESComma separated list of modules to load with server. The variable will be prefixed withbase,web.SESSION_DB_URIConnection string for storing session data in database.PROXY_MODEEnable server proxy mode. Default isFalse.LOG_LEVELSet the logging level. Default isinfo.
Database Manager
The Odoo database manager is disabled by default.
LIST_DBEnable the database manager. Default isFalse.ADMIN_PASSWDMaster password for database manager. Default isodoo.DB_FILTERSet filter for database name. Default is.*.
Process Limits
Odoo is executed as a multi-threaded Python process.
WORKERSDefine how many workers should be spawned. Default is0.LIMIT_REQUESTMaximum number of requests per worker. Default is65536.LIMIT_TIME_CPUMaximum cpu time per request. Default is60.LIMIT_TIME_REALMaximum real time per request. Default is120.
Module Auto Install
With module_change_auto_install module you can disable the auto installation of specific modules.
MODULE_AUTO_INSTALL_DISABLEDComma separated list of modules that should be auto installed. Requiresmodule_change_auto_installinSERVER_WIDE_MODULES.
Module Auto Update
The container uses click-odoo-contrib to update Odoo modules. The feature is disabled by default.
CLICK_ODOO_UPDATEIf enabled click-odoo is used to update modules that have changed. RequiresODOO_DATABASEandODOO_ADDONS_PATH. Default isFalse.
Build
This image can be customized to any extend.
Install packages
Update the image with Python packages.
FROM mintsystem/odoo:16.0.20250311
RUN uv pip install prometheus-client astor fastapi python-multipart ujson a2wsgi parse-accept-language pyjwt
Or with apt packages.
FROM mintsystem/odoo:16.0.20250311
RUN apt-get update && apt-get install -y libgl1-mesa-glx poppler-utils tesseract-ocr
Add custom Odoo conf
Copy custom Odoo conf file to the image.
FROM mintsystem/odoo:16.0.20250311
COPY ./odoo.conf.template /etc/odoo/
Develop
See Odoo Build > Build and publish container image for details.
Internal paths
The most important image paths are:
/etc/odooContains theodoo.confandodoo.conf.templatefiles./var/lib/odoo/filestoreFor every database name Odoo create a filestore./var/lib/odoo/sessionsLocation where werkzeug stores session information./var/lib/odoo/gitThe cloned module repos are stored here./opt/odoo-venvThis is where Python packages are installed./mnt/extra-addonsModule folders are loaded from this path by default.
Capture memory profile
With memray you can visualize the memory usage of Odoo.
Run Odoo with memray.
docker compose run --rm -p 127.0.0.1:8069:8069 odoo memray
Finish the recording with ctrl+c.
Generate the flamegraph and copy the flamegraph to the host.
docker compose run --rm odoo python3 -m memray flamegraph /var/lib/odoo/memray-capture.bin
docker cp odoo:/var/lib/odoo/memray-flamegraph-capture.html ./tmp/