diff --git a/odoo_scripts/docker_build.py b/odoo_scripts/docker_build.py index 773727e69cf44f30c86e2c80fe2dfb052bd17115_b2Rvb19zY3JpcHRzL2RvY2tlcl9idWlsZC5weQ==..1a1ab90b9b89e1ca42282eafb23d5e5a150455c9_b2Rvb19zY3JpcHRzL2RvY2tlcl9idWlsZC5weQ== 100644 --- a/odoo_scripts/docker_build.py +++ b/odoo_scripts/docker_build.py @@ -12,7 +12,7 @@ from python_on_whales import docker -from .config import ODOO_7, ODOO_8, ODOO_10, ODOO_11, ODOO_13, ODOO_14, ODOO_15, Config +from .config import ODOO_7, ODOO_8, ODOO_10, ODOO_11, ODOO_13, ODOO_14, Config from .docker_build_clean import clean from .docker_build_copy import Configuration as CopyConfiguration from .docker_build_copy import add_build_copy_options, copy, get_build_copy_options @@ -193,7 +193,7 @@ call(["cp", dockerfile, debug_dockerfile]) with open(debug_dockerfile, "a") as myfile: - myfile.write("\n# Developer helpers\n") + myfile.write("\n# Developer helpers\nENV PIP_CACHE_DIR=/var/cache/pip\n") if odoo_type in ( ODOO_7, ODOO_8, @@ -201,7 +201,6 @@ ODOO_11, ODOO_13, ODOO_14, - ODOO_15, ): myfile.write("USER root\nRUN apt-get update -qq\n") myfile.write( @@ -205,5 +204,6 @@ ): myfile.write("USER root\nRUN apt-get update -qq\n") myfile.write( - "RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -qq " + "RUN --mount=target=/var/cache/apt,type=cache,sharing=shared " + "DEBIAN_FRONTEND=noninteractive apt-get install -y -qq " ) @@ -209,8 +209,8 @@ ) - if odoo_type in (ODOO_11, ODOO_13, ODOO_14, ODOO_15): + if odoo_type in (ODOO_11, ODOO_13, ODOO_14): myfile.write( "python3-watchdog python3-ipdb python3-pyinotify python3-wheel\n" ) # newer setuptools_scm>6 is not compatible with python 3.5 due # to the use of f-strings myfile.write( @@ -211,10 +211,11 @@ myfile.write( "python3-watchdog python3-ipdb python3-pyinotify python3-wheel\n" ) # newer setuptools_scm>6 is not compatible with python 3.5 due # to the use of f-strings myfile.write( - "RUN python3 -m pip install " + "RUN --mount=target=/var/cache/pip,type=cache,sharing=shared " + "python3 -m pip install " "\"setuptools_scm<6;python_version<='3.5'\"\n" ) # Install pdb++ @@ -218,8 +219,11 @@ "\"setuptools_scm<6;python_version<='3.5'\"\n" ) # Install pdb++ - myfile.write("RUN python3 -m pip install pdbpp\n") + myfile.write( + "RUN --mount=target=/var/cache/pip,type=cache,sharing=shared " + "python3 -m pip install pdbpp\n" + ) myfile.write("USER odoo\n") elif odoo_type in (ODOO_10,): myfile.write("python-ipdb\n") myfile.write( @@ -222,9 +226,10 @@ myfile.write("USER odoo\n") elif odoo_type in (ODOO_10,): myfile.write("python-ipdb\n") myfile.write( - "RUN pip install watchdog --disable-pip-version-check " + "RUN --mount=target=/var/cache/pip,type=cache,sharing=shared pip " + "install watchdog --disable-pip-version-check " "--system --only-binary wheel" ) elif odoo_type in (ODOO_7, ODOO_8): myfile.write("python-ipdb\n") @@ -227,7 +232,10 @@ "--system --only-binary wheel" ) elif odoo_type in (ODOO_7, ODOO_8): myfile.write("python-ipdb\n") - myfile.write("RUN pip install pyinotify") + myfile.write( + "RUN --mount=target=/var/cache/pip,type=cache,sharing=shared pip " + "install pyinotify\n" + ) else: myfile.write( @@ -232,6 +240,7 @@ else: myfile.write( - "RUN python3 -m pip install pdbpp watchdog ipdb pyinotify\n" + "RUN --mount=target=/var/cache/pip,type=cache,sharing=shared " + "python3 -m pip install pdbpp watchdog ipdb pyinotify\n" ) dockerfile = debug_dockerfile