sudo apt-get update && sudo apt-get full-upgrade -y && sudo apt-get autoremove -y && sudo apt-get autoclean
curl https://get.docker.com | bash
mkdir ~/odoo
nano ~/odoo/odoo_pg_pass
pgdbpassword
Create Odoo Config directory:
mkdir ~/odoo/config
nano ~/odoo/config/odoo.conf
[options]
admin_passwd = odoo_db_master_password
db_host = db
db_port = 5432
db_user = odoo
db_password = pgdbpassword
addons_path = /mnt/extra-addons,/mnt/enterprise
nano ~/odoo/entrypoint.sh
#!/bin/bash
set -e
# Check if database exists and web_enterprise is not installed
check_enterprise_installed() {
PGHOST=db PGUSER=odoo PGPASSWORD="$(cat /run/secrets/postgresql_password)" psql -d "$1" -tAc "SELECT 1 FROM ir_module_module WHERE name='web_enterprise' AND state='installed'" | grep -q 1
}
install_enterprise_if_needed() {
local DB_NAME="$1"
if ! check_enterprise_installed "$DB_NAME"; then
echo "Installing web_enterprise in database: $DB_NAME"
odoo --config=/etc/odoo/odoo.conf -d "$DB_NAME" -i web_enterprise --stop-after-init
fi
}
# Install for default database (postgres)
install_enterprise_if_needed "postgres"
# Start Odoo normally
exec "$@"
nano ~/odoo/Dockerfile
# Start from the official Odoo 18 image
FROM odoo:18
# Copy the Enterprise .deb package into the image
COPY ./enterprise/odoo_18.0+e.latest_all.deb /tmp/enterprise.deb
# Install Enterprise and Python dependencies as root
USER root
# Install system packages and Enterprise DEB
RUN apt-get update && \
apt-get install -y --allow-downgrades --no-install-recommends \
/tmp/enterprise.deb \
python3-pip \
python3-venv \
postgresql-client && \
rm -rf /var/lib/apt/lists/* /tmp/enterprise.deb
# Install Python packages system-wide (safer in Docker than on host)
RUN pip3 install --no-cache-dir --break-system-packages google-auth pyjwt
# Ensure Odoo uses the virtual environment
ENV PATH="/opt/odoo-venv/bin:$PATH"
# Copy entrypoint script and set permissions in one step
COPY --chown=odoo:odoo --chmod=07777 ./entrypoint.sh /entrypoint.sh
# Switch back to the unprivileged 'odoo' user
USER odoo
ENTRYPOINT ["/entrypoint.sh"]
CMD ["odoo"]
nano ~/odoo/docker-compose.yml
services:
web:
build: .
depends_on:
db:
condition: service_healthy
restart: always
ports:
- "8069:8069"
- "8072:8072"
volumes:
- odoo-web-data:/var/lib/odoo
- ./config:/etc/odoo
- ./addons:/mnt/extra-addons
- ./enterprise:/mnt/enterprise
environment:
- PASSWORD_FILE=/run/secrets/postgresql_password
secrets:
- postgresql_password
db:
image: postgres:15
environment:
- POSTGRES_DB=postgres
- POSTGRES_PASSWORD_FILE=/run/secrets/postgresql_password
- POSTGRES_USER=odoo
- PGDATA=/var/lib/postgresql/data/pgdata
healthcheck:
test: ["CMD-SHELL", "pg_isready -U odoo -d postgres"]
interval: 5s
timeout: 5s
retries: 5
restart: always
volumes:
- odoo-db-data:/var/lib/postgresql/data/pgdata
secrets:
- postgresql_password
volumes:
odoo-web-data:
odoo-db-data:
secrets:
postgresql_password:
file: odoo_pg_pass
mkdir ~/odoo/enterprise
scp -R /local/path/to/file/odoo_18.0+e.latest_all.deb root@SERVERIP:~/odoo/enterprise
~/odoo/
├── docker-compose.yml
├── odoo_pg_pass # Database password file
├── entrypoint.sh
├── config/
│ └── odoo.conf # Odoo configuration
├── addons/ # Custom modules
├── enterprise/
│ └── odoo_18.0+e.latest_all.deb # Enterprise .deb package
└── Dockerfile # Custom Odoo image with Enterprise pre-installed
cd ~/odoo
chmod 600 ~/odoo/odoo_pg_pass
chmod +x ~/odoo/entrypoint.sh
docker compose up -d
http://IP:8069