Edison Ibañez 699f6d5321 WIP | 7 vuotta sitten | |
---|---|---|
.. | ||
bin | 7 vuotta sitten | |
tests | 7 vuotta sitten | |
.travis.yml | 7 vuotta sitten | |
Dockerfile | 7 vuotta sitten | |
LICENSE.md | 7 vuotta sitten | |
README.md | 7 vuotta sitten | |
docker-entrypoint.sh | 7 vuotta sitten |
This provides an Odoo instance for Docker using Alpine Linux.
It aims to operate in the exact same way as the official Odoo Docker image, although there are also some additional features that are helpful for developers intending to use OCA modules.
One of the main features added to this container is that when an addons path is
mounted as a volume, any dependencies in an oca_dependencies.txt
file will be
downloaded and added into Odoo automagically. The same goes for Python dependencies
in a requirements.txt
.
Another major change is that one Dockerfile supports builds for all Odoo versions.
The default version is the newest production Odoo, but can be changed by setting
the ODOO_VERSION
build argment to the version you would like to use. See more
in the Build Arguments section.
The Docker build for this repo is hosted on Dockerhub.
To configure this module, you need to:
You can use any Postgres server or Docker image for this. We will use the official Postgres image here:
docker pull postgres:9.6-alpine
docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo --name db postgres:9.6-alpine
The below command will run a container with the latest version of Odoo:
docker run -p 8069:8069 --name odoo --link db:db -t laslabs/alpine-odoo:latest
You can run different versions by using the appropriate tag:
# Version 10
docker run -p 8069:8069 --name odoo --link db:db -t laslabs/alpine-odoo:10.0
# Version 9
docker run -p 8069:8069 --name odoo --link db:db -t laslabs/alpine-odoo:9.0
# Version 8
docker run -p 8069:8069 --name odoo --link db:db -t laslabs/alpine-odoo:8.0
The alias of the container running Postgres must be db
for Odoo to be able
to connect to the Postgres server by using default options. See the Environment
Variables section for more information on how to change
this.
docker stop odoo
docker start -a odoo
When a Postgres server is restarted, the Odoo instances linked to it must also be restarted because the server address will have changed.
The Odoo configuration file of this instance is located at /etc/odoo/odoo.conf
.
In order to change the configuration, you would use a volume when starting the container:
docker run -v /path/to/local/directory:/etc/odoo -p 8069:8069 --name odoo --link db:db -t odoo
In the above example, you would put your configuration file at /path/to/local/directory/odoo.conf
on the docker host.
You should use the Odoo official Docker configuration template to write your configuration file, because some values are written into the container.
Note that the addons path is overridden in the Entrypoint in order to allow for automatic discovery of addons from the following directories:
/usr/lib/python2.7/site-packages/openerp/addons
/usr/lib/python2.7/site-packages/odoo/addons
/opt/addons
/opt/odoo/addons
/mnt/addons
You can also directly specify Odoo arguments inline. Those arguments must
be given after the keyword --
in the command-line, such as:
docker run -p 8069:8069 --name odoo --link db:db -t odoo -- --db-filter=odoo_db_.*
You can mount your own Odoo addons directory at /mnt/addons
, such as:
docker run -v /path/to/addons:/mnt/addons -p 8069:8069 --name odoo --link db:db -t odoo
If the mounted directory contains an oca_dependencies.txt
file, those dependencies
will automatically be downloaded and added into the Odoo instance upon starting a
container.
If the mounted directory contains a requirements.txt
file, those dependencies will
automatically be installed into the Odoo environment's Python.
Note that the addons directory must be a directory containing modules. Odoo does not recursively scan directories for modules.
The following build arguments are available for customization:
Name | Default | Description |
---|---|---|
ODOO_VERSION | 10.0 | The Odoo version that is being used. |
ODOO_REPO | odoo/odoo | The Github repository to download Odoo from. |
ODOO_CONFIG_DIR | /etc/odoo | The directory inside of the container where the configuration is stored. |
ODOO_CONFIG | odoo.conf | The name of the Odoo configuration file inside of the container. |
WKHTMLTOX_VERSION | 0.12 | The WKHTMLTOX Major and Minor versions. |
WKHTMLTOX_PATCH_VERSION | 4 | The WKHTMLTOX Patch version. |
You can add them when building directly from the Dockerfile, like so:
docker build --no-cache --build-arg ODOO_VERSION=9.0 -t odoo:9.0 .
This will build an Odoo version 9 instance, instead of the default.
The following environment variables are available for your configuration pleasure:
Name | Default | Description |
---|---|---|
PSQL_HOST | db | The address of the postgres server. If you used a Postgres container, set to the name of the container. |
PSQL_PORT | 5434 | The port that the PostgreSQL server is listening on. |
PSQL_USER | odoo | The PostgreSQL role that Odoo will use to connect with. If you used a Postgres container, set to same value as POSTGRES_USER |
PSQL_PASSWORD | odoo | The password for the PostgreSQL role that Odoo will connect with. If you used a Postgres container, set to same value as POSTGRES_USER |
SKIP_DEPENDS | 0 | Set to 1 in order to skip dependency download/installation from the mounted volume's oca_dependencie.txt and requirements.txt . |
The simplest docker-compose.yml
file would look like:
version: '2'
services:
web:
image: docker pull laslabs/alpine-odoo
depends_on:
- db
ports:
- "8069:8069"
db:
image: postgres:9.6-alpine
environment:
- POSTGRES_PASSWORD=odoo
- POSTGRES_USER=odoo
apk
installations once binary dependencies resolved; a lot are there
as possible build dependencies for repos, and aren't actually used.Bugs are tracked on GitHub Issues. In case of trouble, please check there to see if your issue has already been reported. If you spotted it first, help us to smash it by providing detailed and welcomed feedback.
This module is maintained by LasLabs Inc.