From 9ddc6685aee44a86fde1a88eb3786894b5c3f7b7 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Tue, 31 Jul 2018 09:40:53 +0200 Subject: [PATCH] Reorganize directory structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * /opt/odoo/etc/odoo.cfg.tmpl → /templates/odoo.cfg.tmpl * /opt/odoo/etc/odoo.cfg → /etc/odoo.cfg * /opt/odoo → /odoo * /opt/odoo/bin → /odoo-bin * /opt/odoo/bin_compat → /odoo-bin-compat (for 9.0) * /opt/odoo/before-migrate-entrypoint.d → /before-migrate-entrypoint.d * /opt/odoo/start-entrypoint.d → /start-entrypoint.d This way we have the same path ./odoo outside and inside of the container. bin, etc and entrypoints are not in /odoo, so we can share the whole "odoo" directory with a host volume without shadowing them. Closes #67 --- 10.0/Dockerfile | 29 +++++++--------- 10.0/{etc => templates}/odoo.cfg.tmpl | 0 11.0/Dockerfile | 34 ++++++++---------- 11.0/{etc => templates}/odoo.cfg.tmpl | 0 9.0/Dockerfile | 33 ++++++++---------- 9.0/{bin_compat => bin-compat}/odoo | 0 9.0/{etc => templates}/openerp.cfg.tmpl | 0 HISTORY.rst | 20 +++++++++-- README.md | 8 ++--- bin/check_package | 6 ++-- bin/docker-entrypoint.sh | 46 ++++++++++++------------- bin/lint | 5 +-- bin/migrate | 2 +- bin/runtests | 6 ++-- bin/wait_postgres.sh | 3 -- common/Dockerfile-batteries | 4 +-- common/Dockerfile-onbuild | 18 +++++----- example/README.md | 2 +- example/docker-compose.override.yml | 4 +-- example/odoo/Dockerfile | 28 +++++++-------- example/odoo/Dockerfile-onbuild | 6 ++-- 21 files changed, 125 insertions(+), 129 deletions(-) rename 10.0/{etc => templates}/odoo.cfg.tmpl (100%) rename 11.0/{etc => templates}/odoo.cfg.tmpl (100%) rename 9.0/{bin_compat => bin-compat}/odoo (100%) rename 9.0/{etc => templates}/openerp.cfg.tmpl (100%) diff --git a/10.0/Dockerfile b/10.0/Dockerfile index 38035c0e..c4fe272d 100644 --- a/10.0/Dockerfile +++ b/10.0/Dockerfile @@ -2,11 +2,9 @@ FROM debian:jessie MAINTAINER Camptocamp # create the working directory and a place to set the logs (if wanted) -RUN mkdir -p /opt/odoo /var/log/odoo +RUN mkdir -p /odoo /var/log/odoo -WORKDIR "/opt/odoo" - -COPY ./base_requirements.txt ./ +COPY ./base_requirements.txt /odoo COPY ./install /install # build and dev packages @@ -36,19 +34,19 @@ RUN set -x; \ && /install/wkhtml_12_1_2.sh \ && /install/dev_package.sh \ && pip install -U pip setuptools \ - && pip install -r base_requirements.txt \ + && pip install -r /odoo/base_requirements.txt \ && /install/purge_dev_package_and_cache.sh # grab gosu for easy step-down from root and dockerize to generate template and # wait on postgres RUN /install/gosu.sh && /install/dockerize.sh -COPY ./src_requirements.txt ./ -COPY ./bin /opt/bin -COPY ./etc /opt/etc -COPY ./before-migrate-entrypoint.d /opt/before-migrate-entrypoint.d -COPY ./start-entrypoint.d /opt/start-entrypoint.d -COPY ./MANIFEST.in ./ +COPY ./src_requirements.txt /odoo +COPY ./bin /odoo-bin +COPY ./templates /templates +COPY ./before-migrate-entrypoint.d /before-migrate-entrypoint.d +COPY ./start-entrypoint.d /start-entrypoint.d +COPY ./MANIFEST.in /odoo VOLUME ["/data/odoo", "/var/log/odoo"] @@ -56,7 +54,7 @@ VOLUME ["/data/odoo", "/var/log/odoo"] EXPOSE 8069 8072 ENV ODOO_VERSION=10.0 \ - PATH=/opt/bin:$PATH \ + PATH=/odoo-bin:$PATH \ LANG=C.UTF-8 \ LC_ALL=C.UTF-8 \ DB_HOST=db \ @@ -67,11 +65,8 @@ ENV ODOO_VERSION=10.0 \ ODOO_BASE_URL=http://localhost:8069 \ ODOO_REPORT_URL=http://localhost:8069 \ DEMO=False \ - ADDONS_PATH=/opt/odoo/local-src,/opt/odoo/src/addons \ - OPENERP_SERVER=/opt/etc/odoo.cfg + ADDONS_PATH=/odoo/local-src,/odoo/src/addons \ + OPENERP_SERVER=/etc/odoo.cfg -# set to /opt so we can have the same path outside and inside of the container: -# docker run --rm odoo pytest odoo/external-src/abc/xyz/tests/test.py -WORKDIR "/opt" ENTRYPOINT ["docker-entrypoint.sh"] CMD ["odoo"] diff --git a/10.0/etc/odoo.cfg.tmpl b/10.0/templates/odoo.cfg.tmpl similarity index 100% rename from 10.0/etc/odoo.cfg.tmpl rename to 10.0/templates/odoo.cfg.tmpl diff --git a/11.0/Dockerfile b/11.0/Dockerfile index d899bbae..53532412 100644 --- a/11.0/Dockerfile +++ b/11.0/Dockerfile @@ -2,12 +2,10 @@ FROM debian:stretch MAINTAINER Camptocamp # create the working directory and a place to set the logs (if wanted) -RUN mkdir -p /opt/odoo /var/log/odoo +RUN mkdir -p /odoo /var/log/odoo -WORKDIR "/opt/odoo" - -COPY ./base_requirements.txt ./ -COPY ./extra_requirements.txt ./ +COPY ./base_requirements.txt /odoo +COPY ./extra_requirements.txt /odoo COPY ./install /install # Moved because there was a bug while installing `odoo-autodiscover`. There is @@ -41,19 +39,19 @@ RUN set -x; \ && /install/wkhtml_12_4.sh \ && /install/dev_package.sh \ && python3 -m pip install --force-reinstall pip setuptools \ - && pip3 install -r base_requirements.txt --ignore-installed \ + && pip3 install -r /odoo/base_requirements.txt --ignore-installed \ && /install/purge_dev_package_and_cache.sh # grab gosu for easy step-down from root and dockerize to generate template and # wait on postgres RUN /install/gosu.sh && /install/dockerize.sh -COPY ./src_requirements.txt ./ -COPY ./bin /opt/bin -COPY ./etc /opt/etc -COPY ./before-migrate-entrypoint.d /opt/before-migrate-entrypoint.d -COPY ./start-entrypoint.d /opt/start-entrypoint.d -COPY ./MANIFEST.in ./ +COPY ./src_requirements.txt /odoo +COPY ./bin /odoo-bin +COPY ./templates /templates +COPY ./before-migrate-entrypoint.d /before-migrate-entrypoint.d +COPY ./start-entrypoint.d /start-entrypoint.d +COPY ./MANIFEST.in /odoo VOLUME ["/data/odoo", "/var/log/odoo"] @@ -61,7 +59,7 @@ VOLUME ["/data/odoo", "/var/log/odoo"] EXPOSE 8069 8072 ENV ODOO_VERSION=11.0 \ - PATH=/opt/bin:$PATH \ + PATH=/odoo-bin:$PATH \ LANG=C.UTF-8 \ LC_ALL=C.UTF-8 \ DB_HOST=db \ @@ -71,13 +69,11 @@ ENV ODOO_VERSION=11.0 \ DB_PASSWORD=odoo \ ODOO_BASE_URL=http://localhost:8069 \ ODOO_REPORT_URL=http://localhost:8069 \ - ODOO_DATA_PATH=/opt/odoo/data \ + # the place where you put the data of your project (csv, ...) + ODOO_DATA_PATH=/odoo/data \ DEMO=False \ - ADDONS_PATH=/opt/odoo/local-src,/opt/odoo/src/addons \ - OPENERP_SERVER=/opt/etc/odoo.cfg + ADDONS_PATH=/odoo/local-src,/odoo/src/addons \ + OPENERP_SERVER=/etc/odoo.cfg -# set to /opt so we can have the same path outside and inside of the container: -# docker run --rm odoo pytest odoo/external-src/abc/xyz/tests/test.py -WORKDIR "/opt" ENTRYPOINT ["docker-entrypoint.sh"] CMD ["odoo"] diff --git a/11.0/etc/odoo.cfg.tmpl b/11.0/templates/odoo.cfg.tmpl similarity index 100% rename from 11.0/etc/odoo.cfg.tmpl rename to 11.0/templates/odoo.cfg.tmpl diff --git a/9.0/Dockerfile b/9.0/Dockerfile index 3821db11..f59cdbd1 100644 --- a/9.0/Dockerfile +++ b/9.0/Dockerfile @@ -2,12 +2,10 @@ FROM debian:jessie MAINTAINER Camptocamp # create the working directory and a place to set the logs (if wanted) -RUN mkdir -p /opt/odoo /var/log/odoo +RUN mkdir -p /odoo /var/log/odoo -WORKDIR "/opt/odoo" - -COPY ./base_requirements.txt ./ -COPY ./extra_requirements.txt ./ +COPY ./base_requirements.txt /odoo +COPY ./extra_requirements.txt /odoo COPY ./install /install # build and dev packages @@ -37,20 +35,20 @@ RUN set -x; \ && /install/wkhtml_12_1_2.sh \ && /install/dev_package.sh \ && pip install -U pip setuptools \ - && pip install -r base_requirements.txt \ + && pip install -r /odoo/base_requirements.txt \ && /install/purge_dev_package_and_cache.sh # grab gosu for easy step-down from root and dockerize to generate template and # wait on postgres RUN /install/gosu.sh && /install/dockerize.sh -COPY ./src_requirements.txt ./ -COPY ./bin /opt/bin -COPY ./bin_compat /opt/bin_compat -COPY ./etc /opt/etc -COPY ./before-migrate-entrypoint.d /opt/before-migrate-entrypoint.d -COPY ./start-entrypoint.d /opt/start-entrypoint.d -COPY ./MANIFEST.in ./ +COPY ./src_requirements.txt /odoo +COPY ./bin /odoo-bin +COPY ./bin-compat /odoo-bin-compat +COPY ./templates /templates +COPY ./before-migrate-entrypoint.d /before-migrate-entrypoint.d +COPY ./start-entrypoint.d /start-entrypoint.d +COPY ./MANIFEST.in /odoo VOLUME ["/data/odoo", "/var/log/odoo"] @@ -58,7 +56,7 @@ VOLUME ["/data/odoo", "/var/log/odoo"] EXPOSE 8069 8072 ENV ODOO_VERSION=9.0 \ - PATH=/opt/bin:/opt/bin_compat:$PATH \ + PATH=/odoo-bin:/odoo-bin-compat:$PATH \ LANG=C.UTF-8 \ LC_ALL=C.UTF-8 \ DB_HOST=db \ @@ -69,11 +67,8 @@ ENV ODOO_VERSION=9.0 \ ODOO_BASE_URL=http://localhost:8069 \ ODOO_REPORT_URL=http://localhost:8069 \ DEMO=False \ - ADDONS_PATH=/opt/odoo/local-src,/opt/odoo/src/addons \ - OPENERP_SERVER=/opt/etc/odoo.cfg + ADDONS_PATH=/odoo/local-src,/odoo/src/addons \ + OPENERP_SERVER=/etc/odoo.cfg -# set to /opt so we can have the same path outside and inside of the container: -# docker run --rm odoo pytest odoo/external-src/abc/xyz/tests/test.py -WORKDIR "/opt" ENTRYPOINT ["docker-entrypoint.sh"] CMD ["odoo"] diff --git a/9.0/bin_compat/odoo b/9.0/bin-compat/odoo similarity index 100% rename from 9.0/bin_compat/odoo rename to 9.0/bin-compat/odoo diff --git a/9.0/etc/openerp.cfg.tmpl b/9.0/templates/openerp.cfg.tmpl similarity index 100% rename from 9.0/etc/openerp.cfg.tmpl rename to 9.0/templates/openerp.cfg.tmpl diff --git a/HISTORY.rst b/HISTORY.rst index 0bd91c79..eb9a0cc2 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -22,6 +22,22 @@ Release History Unreleased ++++++++++ +.. DANGER:: Breaking changes + + Flavors: you have either to use the ``onbuild`` flavor, either to add the + ``COPY`` instructions in your projects Dockerfiles. + + Directories have been re-arranged, you must adapt addons-path, volumes or COPY instructions: + + * /opt/odoo/etc/odoo.cfg.tmpl → /templates/odoo.cfg.tmpl + * /opt/odoo/etc/odoo.cfg → /etc/odoo.cfg + * /opt/odoo → /odoo + * /opt/odoo/bin → /odoo-bin + * /opt/odoo/bin_compat → /odoo-bin-compat (for 9.0) + * /opt/odoo/before-migrate-entrypoint.d → /before-migrate-entrypoint.d + * /opt/odoo/start-entrypoint.d → /start-entrypoint.d + + **Features and Improvements** * Refactor code to be able to share code between versions (see common and bin directories) @@ -29,8 +45,8 @@ Unreleased * normal image without "onbuild" * normal image with "onbuild" instructions - * batteries-included image without "unbuild" - * batteries-included with "unbuild" instructions + * batteries-included image without "onbuild" + * batteries-included with "onbuild" instructions * Batteries-included flavor includes a selected list of python packages commonly used in OCA addons (see extra_requirements.txt) * Do not use the "latest" image, pick your flavor after you read the readme diff --git a/README.md b/README.md index 796a9125..7bbc07af 100644 --- a/README.md +++ b/README.md @@ -190,12 +190,12 @@ then share the same user. The main configuration options of Odoo can be configured through environment variables. The name of the environment variables are the same of the options but uppercased (eg. `workers` becomes `WORKERS`). -Look in [9.0/etc/openerp.cfg.tmpl](9.0/etc/openerp.cfg.tmpl) to see the full list. +Look in [11.0/templates/odoo.cfg.tmpl](11.0/templates/odoo.cfg.tmpl) to see the full list. While most of the variables can be set in the docker-compose file so we can have different values for different environments, the `ADDONS_PATH` **must** be set in the `Dockerfile` of your project with a line such as: ``` -ENV ADDONS_PATH=/opt/odoo/local-src,/opt/odoo/external-src/server-tools,/opt/odoo/src/addons +ENV ADDONS_PATH=/odoo/local-src,/odoo/external-src/server-tools,/odoo/src/addons ``` By setting this value in the `Dockerfile`, it will be integrated into the build and thus will be consistent across each environment. @@ -240,9 +240,9 @@ Odoo namespaces (`openerp.addons`/`odoo.addons`) when running the tests. ## Start entrypoint -Any script in any language placed in `/opt/odoo/start-entrypoint.d` will be +Any script in any language placed in `/start-entrypoint.d` will be executed just between the migration and the start of Odoo. -Similarly, scripts placed in `/opt/odoo/before-migrate-entrypoint.d` will be +Similarly, scripts placed in `/before-migrate-entrypoint.d` will be executed just before the migration. The order of execution of the files is determined by the `run-parts` 's rules. diff --git a/bin/check_package b/bin/check_package index 25e9dda1..46f304d3 100755 --- a/bin/check_package +++ b/bin/check_package @@ -1,9 +1,11 @@ #!/bin/bash -cat /opt/odoo/base_requirements.txt > requirements.txt +set -e + +cat /odoo/base_requirements.txt > requirements.txt if [ "$BATTERIES" = "True" ] - then cat /opt/odoo/extra_requirements.txt >> requirements.txt + then cat /odoo/extra_requirements.txt >> requirements.txt fi sed -i '/^\s*$/d' requirements.txt diff --git a/bin/docker-entrypoint.sh b/bin/docker-entrypoint.sh index f713f98f..fdb06e21 100755 --- a/bin/docker-entrypoint.sh +++ b/bin/docker-entrypoint.sh @@ -9,9 +9,6 @@ USER_ID=${LOCAL_USER_ID:-999} echo "Starting with UID : $USER_ID" id -u odoo &> /dev/null || useradd --shell /bin/bash -u $USER_ID -o -c "" -m odoo -BINDIR=$(dirname $0) -BASEDIR=$(readlink -f $BINDIR/..) - export PGHOST=${DB_HOST} export PGPORT=${DB_PORT} export PGUSER=${DB_USER} @@ -60,47 +57,48 @@ case "$(echo "${DEMO}" | tr '[:upper:]' '[:lower:]' )" in esac # Create configuration file from the template -CONFIGDIR=/opt/etc -if [ -e $CONFIGDIR/openerp.cfg.tmpl ]; then - dockerize -template $CONFIGDIR/openerp.cfg.tmpl:$CONFIGDIR/odoo.cfg +TEMPLATES_DIR=/templates +CONFIG_TARGET=/etc/odoo.cfg +if [ -e $TEMPLATES_DIR/openerp.cfg.tmpl ]; then + dockerize -template $TEMPLATES_DIR/openerp.cfg.tmpl:$CONFIG_TARGET fi -if [ -e $CONFIGDIR/odoo.cfg.tmpl ]; then - dockerize -template $CONFIGDIR/odoo.cfg.tmpl:$CONFIGDIR/odoo.cfg +if [ -e $TEMPLATES_DIR/odoo.cfg.tmpl ]; then + dockerize -template $TEMPLATES_DIR/odoo.cfg.tmpl:$CONFIG_TARGET fi -if [ ! -f "$CONFIGDIR/odoo.cfg" ]; then - echo "Error: one of etc/openerp.cfg.tmpl, etc/odoo.cfg.tmpl, etc/odoo.cfg is required" +if [ ! -f "/etc/odoo.cfg" ]; then + echo "Error: one of /templates/openerp.cfg.tmpl, /templates/odoo.cfg.tmpl, /etc/odoo.cfg is required" exit 1 fi -if [ -z "$(pip list --format=columns | grep "/opt/odoo/src")" ]; then +if [ -z "$(pip list --format=columns | grep "/odoo/src")" ]; then # The build runs 'pip install -e' on the odoo src, which creates an - # odoo.egg-info directory *inside /opt/odoo/src*. So when we run a container + # odoo.egg-info directory *inside /odoo/src*. So when we run a container # with a volume shared with the host, we don't have this .egg-info (at least # the first time). # When it happens, we reinstall the odoo python package. We don't want to run # the install everytime because it would slow the start of the containers - echo '/opt/odoo/src/odoo.egg-info is missing, probably because the directory is a volume.' - echo 'Running pip install -e /opt/odoo/src to restore odoo.egg-info' - pip install -e /opt/odoo/src + echo '/odoo/src/odoo.egg-info is missing, probably because the directory is a volume.' + echo 'Running pip install -e /odoo/src to restore odoo.egg-info' + pip install -e /odoo/src # As we write in a volume, ensure it has the same user. # So when the src is a host volume and we set the LOCAL_USER_ID to be the # host user, the files are owned by the host user - chown -R odoo: /opt/odoo/src/odoo.egg-info + chown -R odoo: /odoo/src/odoo.egg-info fi # Same logic but for your custom project -if [ -z "$(pip list --format=columns | grep "/opt/odoo" | grep -v "/opt/odoo/src")" ]; then - echo '/opt/src/*.egg-info is missing, probably because the directory is a volume.' - echo 'Running pip install -e /opt/odoo to restore *.egg-info' - pip install -e /opt/odoo - chown -R odoo: /opt/odoo/*.egg-info +if [ -z "$(pip list --format=columns | grep "/odoo" | grep -v "/odoo/src")" ]; then + echo '/src/*.egg-info is missing, probably because the directory is a volume.' + echo 'Running pip install -e /odoo to restore *.egg-info' + pip install -e /odoo + chown -R odoo: /odoo/*.egg-info fi # Wait until postgres is up -$BINDIR/wait_postgres.sh +wait_postgres.sh mkdir -p /data/odoo/{addons,filestore,sessions} if [ ! "$(stat -c '%U' /data/odoo)" = "odoo" ]; then @@ -113,7 +111,7 @@ fi BASE_CMD=$(basename $1) if [ "$BASE_CMD" = "odoo" ] || [ "$BASE_CMD" = "odoo.py" ] ; then - BEFORE_MIGRATE_ENTRYPOINT_DIR=/opt/odoo/before-migrate-entrypoint.d + BEFORE_MIGRATE_ENTRYPOINT_DIR=/odoo/before-migrate-entrypoint.d if [ -d "$BEFORE_MIGRATE_ENTRYPOINT_DIR" ]; then run-parts --verbose "$BEFORE_MIGRATE_ENTRYPOINT_DIR" fi @@ -122,7 +120,7 @@ if [ "$BASE_CMD" = "odoo" ] || [ "$BASE_CMD" = "odoo.py" ] ; then gosu odoo migrate fi - START_ENTRYPOINT_DIR=/opt/odoo/start-entrypoint.d + START_ENTRYPOINT_DIR=/odoo/start-entrypoint.d if [ -d "$START_ENTRYPOINT_DIR" ]; then run-parts --verbose "$START_ENTRYPOINT_DIR" fi diff --git a/bin/lint b/bin/lint index 557d591d..bd5fd5c2 100755 --- a/bin/lint +++ b/bin/lint @@ -1,7 +1,4 @@ #!/bin/bash set -e -BINDIR=$(dirname $0) -BASEDIR=$(readlink -f $BINDIR/..) - -flake8 $BASEDIR/local-src --exclude=__init__.py +flake8 /odoo/local-src --exclude=__init__.py diff --git a/bin/migrate b/bin/migrate index 9ec58941..3fe7666e 100755 --- a/bin/migrate +++ b/bin/migrate @@ -5,7 +5,7 @@ if ! PGPASSWORD=$DB_PASSWORD psql -lqtA -h $DB_HOST -U $DB_USER | grep -q "^$DB_ PGPASSWORD=$DB_PASSWORD createdb -h $DB_HOST -U $DB_USER -O $DB_USER $DB_NAME fi -CONFIGFILE=/opt/odoo/migration.yml +CONFIGFILE=/odoo/migration.yml MARABUNTA_DB_HOST=$DB_HOST \ MARABUNTA_DATABASE=$DB_NAME \ MARABUNTA_DB_USER=$DB_USER \ diff --git a/bin/runtests b/bin/runtests index 13368ebe..385cb446 100755 --- a/bin/runtests +++ b/bin/runtests @@ -10,11 +10,11 @@ set -e # TODO: if we are not in TRAVIS, make a template then run tests on a copy wait_postgres.sh -LOCAL_SRC_DIR=/opt/odoo/local-src -ODOO_BIN_PATH=/opt/odoo/src/odoo-bin +LOCAL_SRC_DIR=/odoo/local-src +ODOO_BIN_PATH=/odoo/src/odoo-bin if [ "$ODOO_VERSION" == "9.0" ] then - ODOO_BIN_PATH=/opt/odoo/src/odoo.py + ODOO_BIN_PATH=/odoo/src/odoo.py fi diff --git a/bin/wait_postgres.sh b/bin/wait_postgres.sh index e58f9588..69cf67c0 100755 --- a/bin/wait_postgres.sh +++ b/bin/wait_postgres.sh @@ -4,9 +4,6 @@ # set -e -BASEDIR=$(dirname $0) -CONFIGDIR=/opt/etc - dockerize -timeout 30s -wait tcp://${DB_HOST}:${DB_PORT} # now the port is up but sometimes postgres is not totally ready yet: diff --git a/common/Dockerfile-batteries b/common/Dockerfile-batteries index ea5072c0..d83d619c 100644 --- a/common/Dockerfile-batteries +++ b/common/Dockerfile-batteries @@ -1,6 +1,6 @@ MAINTAINER Camptocamp -WORKDIR "/opt/odoo" +WORKDIR "/odoo" COPY ./extra_requirements.txt ./ # Install extra requirement @@ -9,4 +9,4 @@ RUN set -x; \ && pip install -r extra_requirements.txt \ && /install/purge_dev_package_and_cache.sh -WORKDIR "/opt" +WORKDIR "/" diff --git a/common/Dockerfile-onbuild b/common/Dockerfile-onbuild index 51f8cb38..2120395b 100644 --- a/common/Dockerfile-onbuild +++ b/common/Dockerfile-onbuild @@ -2,13 +2,13 @@ MAINTAINER Camptocamp # intermediate images should help speed up builds when only local-src, or only # external-src changes -ONBUILD COPY ./src /opt/odoo/src -ONBUILD COPY ./external-src /opt/odoo/external-src -ONBUILD COPY ./local-src /opt/odoo/local-src -ONBUILD COPY ./data /opt/odoo/data -ONBUILD COPY ./songs /opt/odoo/songs -ONBUILD COPY ./setup.py /opt/odoo/ -ONBUILD COPY ./VERSION /opt/odoo/ -ONBUILD COPY ./migration.yml /opt/odoo/ +ONBUILD COPY ./src /odoo/src +ONBUILD COPY ./external-src /odoo/external-src +ONBUILD COPY ./local-src /odoo/local-src +ONBUILD COPY ./data /odoo/data +ONBUILD COPY ./songs /odoo/songs +ONBUILD COPY ./setup.py /odoo/ +ONBUILD COPY ./VERSION /odoo/ +ONBUILD COPY ./migration.yml /odoo/ # need to be called at the end, because it installs . and src -ONBUILD RUN cd /opt/odoo && pip install -r src_requirements.txt +ONBUILD RUN cd /odoo && pip install -r src_requirements.txt diff --git a/example/README.md b/example/README.md index 4e09588e..a182c312 100644 --- a/example/README.md +++ b/example/README.md @@ -30,7 +30,7 @@ Follow the steps: FROM camptocamp/odoo-project:9.0 MAINTAINER - ENV ADDONS_PATH=/opt/odoo/local-src,/opt/odoo/external-src/server-tools,/opt/odoo/src/addons + ENV ADDONS_PATH=/odoo/local-src,/odoo/external-src/server-tools,/odoo/src/addons 7. Build your image diff --git a/example/docker-compose.override.yml b/example/docker-compose.override.yml index 3a48f5f1..bf7a39d4 100644 --- a/example/docker-compose.override.yml +++ b/example/docker-compose.override.yml @@ -12,9 +12,9 @@ services: - 8069 - 8072 volumes: - - "data-odoo-pytest-cache:/opt/odoo/.cache" + - "data-odoo-pytest-cache:/odoo/.cache" # to speed build of image customise your .dockerfileignore (this is an help their) - - "./odoo:/opt/odoo" + - "./odoo:/odoo" environment: - MARABUNTA_MODE=demo # could be 'full' for the db with all the data - MARABUNTA_ALLOW_SERIE=True # should not be set in production diff --git a/example/odoo/Dockerfile b/example/odoo/Dockerfile index 0506705c..182bec0d 100644 --- a/example/odoo/Dockerfile +++ b/example/odoo/Dockerfile @@ -2,21 +2,21 @@ FROM camptocamp/odoo-project:10.0-latest MAINTAINER Camptocamp # For installing odoo you have two possibility adding the whole root directory -#COPY . /opt/odoo +#COPY . /odoo # or adding each directory, this solution will reduce the download time # of the image on the server (we can reuse layout) -COPY ./src /opt/odoo/src -COPY ./external-src /opt/odoo/external-src -COPY ./local-src /opt/odoo/local-src -COPY ./data /opt/odoo/data -COPY ./songs /opt/odoo/songs -COPY ./setup.py /opt/odoo/ -COPY ./VERSION /opt/odoo/ -COPY ./migration.yml /opt/odoo/ +COPY ./src /odoo/src +COPY ./external-src /odoo/external-src +COPY ./local-src /odoo/local-src +COPY ./data /odoo/data +COPY ./songs /odoo/songs +COPY ./setup.py /odoo/ +COPY ./VERSION /odoo/ +COPY ./migration.yml /odoo/ -RUN pip install -e /opt/odoo -RUN pip install -e /opt/odoo/src +RUN pip install -e /odoo +RUN pip install -e /odoo/src # Project's specifics packages RUN set -x; \ @@ -26,7 +26,7 @@ RUN set -x; \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -COPY ./requirements.txt /opt/odoo/ -RUN cd /opt/odoo && pip install -r requirements.txt +COPY ./requirements.txt /odoo/ +RUN cd /odoo && pip install -r requirements.txt -ENV ADDONS_PATH=/opt/odoo/local-src,/opt/odoo/src/addons +ENV ADDONS_PATH=/odoo/local-src,/odoo/src/addons diff --git a/example/odoo/Dockerfile-onbuild b/example/odoo/Dockerfile-onbuild index 3f93b73a..93c429ff 100644 --- a/example/odoo/Dockerfile-onbuild +++ b/example/odoo/Dockerfile-onbuild @@ -9,7 +9,7 @@ RUN set -x; \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -COPY ./requirements.txt /opt/odoo/ -RUN cd /opt/odoo && pip install -r requirements.txt +COPY ./requirements.txt /odoo/ +RUN cd /odoo && pip install -r requirements.txt -ENV ADDONS_PATH=/opt/odoo/local-src,/opt/odoo/src/addons +ENV ADDONS_PATH=/odoo/local-src,/odoo/src/addons