From c6107e9b9137487860e71b003975744f4471697e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Todorovich?= Date: Wed, 8 Apr 2026 09:12:08 -0300 Subject: [PATCH] feat: remove deprecated onbuild image variants The -onbuild variants have been deprecated by Docker for years. The README itself noted they are not recommended. Removing them eliminates 2 extra flavors per version and simplifies the build and maintenance. --- 11.0/src_requirements.txt | 3 --- 12.0/src_requirements.txt | 3 --- 13.0/src_requirements.txt | 3 --- 14.0/src_requirements.txt | 3 --- 15.0/src_requirements.txt | 3 --- 16.0/src_requirements.txt | 3 --- 17.0/src_requirements.txt | 3 --- 18.0/src_requirements.txt | 3 --- 19.0/src_requirements.txt | 3 --- README.md | 32 +------------------------------- build.sh | 5 ----- common/Dockerfile-onbuild | 16 ---------------- 12 files changed, 1 insertion(+), 79 deletions(-) delete mode 100644 common/Dockerfile-onbuild diff --git a/11.0/src_requirements.txt b/11.0/src_requirements.txt index b1ecc161..c3635873 100644 --- a/11.0/src_requirements.txt +++ b/11.0/src_requirements.txt @@ -1,8 +1,5 @@ # Requirements for the project itself and for Odoo. # When we install Odoo with -e, odoo.py is available in the PATH and # 'openerp' in the PYTHONPATH -# -# They are installed only after all the project's files have been copied -# into the image (with ONBUILD) -e . -e src diff --git a/12.0/src_requirements.txt b/12.0/src_requirements.txt index b1ecc161..c3635873 100644 --- a/12.0/src_requirements.txt +++ b/12.0/src_requirements.txt @@ -1,8 +1,5 @@ # Requirements for the project itself and for Odoo. # When we install Odoo with -e, odoo.py is available in the PATH and # 'openerp' in the PYTHONPATH -# -# They are installed only after all the project's files have been copied -# into the image (with ONBUILD) -e . -e src diff --git a/13.0/src_requirements.txt b/13.0/src_requirements.txt index b1ecc161..c3635873 100644 --- a/13.0/src_requirements.txt +++ b/13.0/src_requirements.txt @@ -1,8 +1,5 @@ # Requirements for the project itself and for Odoo. # When we install Odoo with -e, odoo.py is available in the PATH and # 'openerp' in the PYTHONPATH -# -# They are installed only after all the project's files have been copied -# into the image (with ONBUILD) -e . -e src diff --git a/14.0/src_requirements.txt b/14.0/src_requirements.txt index b1ecc161..c3635873 100644 --- a/14.0/src_requirements.txt +++ b/14.0/src_requirements.txt @@ -1,8 +1,5 @@ # Requirements for the project itself and for Odoo. # When we install Odoo with -e, odoo.py is available in the PATH and # 'openerp' in the PYTHONPATH -# -# They are installed only after all the project's files have been copied -# into the image (with ONBUILD) -e . -e src diff --git a/15.0/src_requirements.txt b/15.0/src_requirements.txt index b1ecc161..c3635873 100644 --- a/15.0/src_requirements.txt +++ b/15.0/src_requirements.txt @@ -1,8 +1,5 @@ # Requirements for the project itself and for Odoo. # When we install Odoo with -e, odoo.py is available in the PATH and # 'openerp' in the PYTHONPATH -# -# They are installed only after all the project's files have been copied -# into the image (with ONBUILD) -e . -e src diff --git a/16.0/src_requirements.txt b/16.0/src_requirements.txt index b1ecc161..c3635873 100644 --- a/16.0/src_requirements.txt +++ b/16.0/src_requirements.txt @@ -1,8 +1,5 @@ # Requirements for the project itself and for Odoo. # When we install Odoo with -e, odoo.py is available in the PATH and # 'openerp' in the PYTHONPATH -# -# They are installed only after all the project's files have been copied -# into the image (with ONBUILD) -e . -e src diff --git a/17.0/src_requirements.txt b/17.0/src_requirements.txt index b1ecc161..c3635873 100644 --- a/17.0/src_requirements.txt +++ b/17.0/src_requirements.txt @@ -1,8 +1,5 @@ # Requirements for the project itself and for Odoo. # When we install Odoo with -e, odoo.py is available in the PATH and # 'openerp' in the PYTHONPATH -# -# They are installed only after all the project's files have been copied -# into the image (with ONBUILD) -e . -e src diff --git a/18.0/src_requirements.txt b/18.0/src_requirements.txt index b1ecc161..c3635873 100644 --- a/18.0/src_requirements.txt +++ b/18.0/src_requirements.txt @@ -1,8 +1,5 @@ # Requirements for the project itself and for Odoo. # When we install Odoo with -e, odoo.py is available in the PATH and # 'openerp' in the PYTHONPATH -# -# They are installed only after all the project's files have been copied -# into the image (with ONBUILD) -e . -e src diff --git a/19.0/src_requirements.txt b/19.0/src_requirements.txt index b1ecc161..c3635873 100644 --- a/19.0/src_requirements.txt +++ b/19.0/src_requirements.txt @@ -1,8 +1,5 @@ # Requirements for the project itself and for Odoo. # When we install Odoo with -e, odoo.py is available in the PATH and # 'openerp' in the PYTHONPATH -# -# They are installed only after all the project's files have been copied -# into the image (with ONBUILD) -e . -e src diff --git a/README.md b/README.md index cc63aa91..d39813c6 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,10 @@ https://github.com/camptocamp/docker-odoo-project/pkgs/container/odoo-project ## Image Flavors -There are 4 flavors of the image: +There are 2 flavors of the image: - normal: `odoo-project:${odoo_version}-${tag_version}` -- normal-onbuild: `odoo-project:${odoo_version}-${tag_version}-onbuild` - batteries-included: `odoo-project:${odoo_version}-${tag_version}-batteries` -- batteries-included-onbuild: `odoo-project:${odoo_version}-${tag_version}-batteries-onbuild` Note: in production, we strongly recommend to never use the "latest" tag. Instead use a specific version in order to be able to rebuild identical images. @@ -59,26 +57,6 @@ The list of package (with their version) is defined in the extra_requirements.tx you can also see the Dockerfile that generate this image here: [common/Dockerfile-batteries](common/Dockerfile-batteries) -### With or without onbuild? - -The `onbuild` flavors add default *ONBUILD* instructions in the Dockerfile in -order to simplify the generation of custom image. - -For more information on the *ONBUILD* command please read Docker documentation - -The dockerfile for this flavor is here: [common/Dockerfile-onbuild](common/Dockerfile-onbuild) - -For comparison, two example of Dockerfile are shown in the project example here: - -- without onbuild: [example/odoo/Dockerfile](example/odoo/Dockerfile) -- with onbuild: [example/odoo/Dockerfile-onbuild](example/odoo/Dockerfile-onbuild) - -Note: the Dockerfile of the onbuild flavor is shorter but - -- you can not create intermediary custom image based on it (as ONBUILD instruction need to be played). -- the official docker images have deprecated their `-onbuild` images: https://github.com/docker-library/official-images/issues/2076 - - ## Build The images should be build with `make`: @@ -86,22 +64,14 @@ The images should be build with `make`: Normal flavors: ``` -# generate image camptocamp/odoo-project:11.0-latest and camptocamp/odoo-project:11.0-latest-onbuild $ make VERSION=11.0 -# generate image camptocamp/odoo-project:10.0-latest and camptocamp/odoo-project:10.0-latest-onbuild $ make VERSION=10.0 -# generate image camptocamp/odoo-project:9.0-latest and camptocamp/odoo-project:9.0-latest-onbuild -$ make VERSION=9.0 ``` Batteries-included flavors: ``` -# generate image camptocamp/odoo-project:11.0-batteries-latest and camptocamp/odoo-project:11.0-latest-batteries-onbuild $ make VERSION=11.0 BATTERIES=True -# generate image camptocamp/odoo-project:10.0-batteries-latest and camptocamp/odoo-project:10.0-latest-batteries-onbuild $ make VERSION=10.0 BATTERIES=True -# generate image camptocamp/odoo-project:9.0-batteries-latest and camptocamp/odoo-project:9.0-latest-batteries-onbuild -$ make VERSION=9.0 BATTERIES=True ``` diff --git a/build.sh b/build.sh index 3a06857f..c255861b 100755 --- a/build.sh +++ b/build.sh @@ -33,15 +33,10 @@ trap on_exit EXIT cp -r ${VERSION}/. ${TMP}/ cp -r bin/ ${TMP} cp -rT common/ ${TMP} -cp ${TMP}/Dockerfile-onbuild ${TMP}/Dockerfile-batteries-onbuild -sed -i "1i FROM ${BUILD_TAG}" ${TMP}/Dockerfile-onbuild sed -i "1i FROM ${BUILD_TAG}" ${TMP}/Dockerfile-batteries -sed -i "1i FROM ${BUILD_TAG}-batteries" ${TMP}/Dockerfile-batteries-onbuild cp -r install/ ${TMP} cp -r start-entrypoint.d/ ${TMP} cp -r before-migrate-entrypoint.d/ ${TMP} docker build --no-cache -f ${TMP}/Dockerfile -t ${BUILD_TAG} ${TMP} -docker build --no-cache -f ${TMP}/Dockerfile-onbuild -t ${BUILD_TAG}-onbuild ${TMP} docker build --no-cache -f ${TMP}/Dockerfile-batteries -t ${BUILD_TAG}-batteries ${TMP} -docker build --no-cache -f ${TMP}/Dockerfile-batteries-onbuild -t ${BUILD_TAG}-batteries-onbuild ${TMP} diff --git a/common/Dockerfile-onbuild b/common/Dockerfile-onbuild deleted file mode 100644 index 5e6d722c..00000000 --- a/common/Dockerfile-onbuild +++ /dev/null @@ -1,16 +0,0 @@ -MAINTAINER Camptocamp - -COPY ./.coveragerc /odoo/ - -# intermediate images should help speed up builds when only local-src, or only -# external-src changes -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 /odoo && pip install -r src_requirements.txt