Re-add GLOBAL_PIP_CACHE removed by mistake
@@ -945,6 +945,9 @@ class DockerBuildEnvironment(BuildEnvironment):
It uses Docker Volume if running on a docker-compose. Otherwise, it
returns just a regular mountpoint path.
+
+ Besides, it binds the ``GLOBAL_PIP_CACHE`` if it's set and we are under
+ ``DEBUG`` mode.
"""
if getattr(settings, 'RTD_DOCKER_COMPOSE', False):
from pathlib import Path
@@ -961,6 +964,15 @@ class DockerBuildEnvironment(BuildEnvironment):
'mode': 'rw',
},
}
+
+ if settings.GLOBAL_PIP_CACHE and settings.DEBUG:
+ binds.update({
+ self.project.pip_cache_path: {
+ 'bind': self.project.pip_cache_path,
+ 'mode': 'rw',
+ },
+ })
+
return binds
def get_container_host_config(self):
@@ -969,8 +981,6 @@ class DockerBuildEnvironment(BuildEnvironment):
It mainly generates the proper path bindings between the Docker
container and the Host by mounting them with the proper permissions.
- Besides, it mounts the ``GLOBAL_PIP_CACHE`` if it's set and we are under
- ``DEBUG``.
The object returned is passed to Docker function
``client.create_container``.
