Odoo Build
A better Odoo image.
- Ships with python 3.11
- Odoo source is based on exact git revision
- Setup
odoo.confwith environment vars - Clone addons from git repos
- Install pip packages without building the image
- Detects addons in nested module folders
- Store session information in database
- Get environment name from server config
- Initialize database with selected modules
- Auto update modules that have changed
Source: https://github.com/Mint-System/Odoo-Build/tree/16.0/build
Usage
version: "3"
services:
odoo:
container_name: odoo
image: mintsystem/odoo:16.0.20241125
depends_on:
- db
environment:
HOST: db
USER: odoo
PASSWORD: odoo
PORT: 5432
ENVIRONMENT: production
GIT_SSH_PUBLIC_KEY: ssh-ed25519 BBBBC3NzaC1lZDI1NTE5BBBBIDR9Ibi0mATjCyx1EYg594oFkY0rghtgo+pnFHOvAcym Mint-System-Project-MCC@github.com
GIT_SSH_PRIVATE_KEY: |
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACA0fSG4tJgE4wssdRGIOfeKBZGNK4IbYKPqZxRzrwHMpgAAAKi5ZBaFuWQW
hQAAAAtzc2gtZWQyNTUxOQAAACA0fSG4tJgE4wssdRGIOfeKBZGNK4IbYKPqZxRzrwHMpg
0BAgM=
-----END OPENSSH PRIVATE KEY-----
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_ADDONS_INIT: web
ODOO_ADDONS_INIT_LANG: de_CH
ODOO_ADDONS_AUTO_UPDATE: True
SERVER_WIDE_MODULES: web,session_db
PIP_INSTALL: astor
SESSION_DB_URI: postgres://odoo:odoo@db/16.0
LOG_LEVEL: debug
ADMIN_PASSWD: oqua9AiHeibac2pie9ei
DBFILTER: ^%d$
LIST_DB: False
PROXY_MODE: True
WORKERS: 4
LIMIT_REQUEST: 16384
LIMIT_TIME_CPU: 300
LIMIT_TIME_REAL: 600
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:
Database Connection
Odoo supports the PostgreSQL database only.
HOSTName of the database container.USERDatabase username.PASSWORDDatabase user password.PORTPostgres server port. Default is5432.
Module Repos
The entrypoint script can clone git repositories.
GIT_SSH_PUBLIC_KEYPublic key for SSH connection.GIT_SSH_PRIVATE_KEYPrivate key for SSH connection.ADDONS_GIT_REPOSComma seperated list of git clone urls appended with#and branch name.
Addons
The entrypoint script searches for module folders in the addons paths and creates a new addons path.
ODOO_ADDONS_PATHComma seperated list of container paths to the addons folders.ODOO_INIT_DBName of the database to initialise. Default isodoo.ODOO__INIT_LANGLanguage used for database initialisation. Default isen_US.ODOO_ADDONS_INITProvide comma separated list of modules for database initialisation. Default isweb.ODOO_ADDONS_AUTO_UPDATEDetect file changes in module folders and update these modules. Default isFalse
The default login is admin:admin.
Server Environment
The Odoo server can be configured using the following env vars.
ENVIRONMENTProvide an environment name. Can be accessed withconfig.get("environment").PIP_INSTALLSpace seperated list of python packages.SERVER_WIDE_MODULESComma separated list of modules to load with server.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 a multi-thread 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.
Container Paths
Here are the most important container paths.
/etc/odooContains theodoo.confandodoo.conf.templatefiles./var/lib/odoo/filestoreFor every database name Odoo create a filestore./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.
Develop
As with every Docker image this image can be updated.
Install packages
Extend the image with additional Python packages.
FROM mintsystem/odoo:16.0.20241125
RUN pip install prometheus-client astor fastapi python-multipart ujson a2wsgi parse-accept-language pyjwt
Add custom Odoo conf
Copy a custom Odoo conf file to the image.
FROM mintsystem/odoo:16.0.20241125
COPY ./odoo.conf.template /etc/odoo/
Troubleshooting
Session folder not writable
Problem
When starting the container the following error shows up:
/var/lib/odoo/sessions: directory is not writable
Cause
The Odoo user/group have a different uid/gid.
Solution
docker exec -u root -it $CONTAINER bash
chown -R odoo:odoo /var/lib/odoo