From 53262e54009cf41fc74b21ef932424674e9e6eeb Mon Sep 17 00:00:00 2001 From: Fabian Zach Date: Mon, 16 Mar 2020 17:36:25 +0100 Subject: [PATCH 1/2] Allow to add additional binds to Docker build container Sometimes it might be necessary to add additional binds to the build container, e.g. to add SSH keys for the docs user to clone private repositories or for caches. These additional binds can be specified as field in settings: RTD_DOCKER_ADDITIONAL_BINDS = { '/home/docs/.ssh': { 'bind': '/home/docs/.ssh', 'mode': 'ro', } } --- readthedocs/doc_builder/environments.py | 2 ++ readthedocs/settings/base.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/readthedocs/doc_builder/environments.py b/readthedocs/doc_builder/environments.py index 5ad91a9c8e2..fc3e5dee168 100644 --- a/readthedocs/doc_builder/environments.py +++ b/readthedocs/doc_builder/environments.py @@ -991,6 +991,8 @@ def _get_binds(self): }, } + binds.update(getattr(settings, 'RTD_DOCKER_ADDITIONAL_BINDS', {})) + return binds def get_container_host_config(self): diff --git a/readthedocs/settings/base.py b/readthedocs/settings/base.py index 59476ac4ae1..e6881c42015 100644 --- a/readthedocs/settings/base.py +++ b/readthedocs/settings/base.py @@ -488,6 +488,8 @@ def TEMPLATES(self): 'readthedocs/build:latest': DOCKER_IMAGE_SETTINGS.get('readthedocs/build:6.0'), 'readthedocs/build:testing': DOCKER_IMAGE_SETTINGS.get('readthedocs/build:7.0'), }) + # additional binds for the build container + RTD_DOCKER_ADDITIONAL_BINDS = {} def _get_docker_memory_limit(self): try: From 7fee93bf35bc3a77cc93cffae976dca3b84580c7 Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Mon, 23 Nov 2020 11:42:20 -0500 Subject: [PATCH 2/2] Apply suggestions from code review --- readthedocs/doc_builder/environments.py | 2 +- readthedocs/settings/base.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/readthedocs/doc_builder/environments.py b/readthedocs/doc_builder/environments.py index fc3e5dee168..9958a1400e0 100644 --- a/readthedocs/doc_builder/environments.py +++ b/readthedocs/doc_builder/environments.py @@ -991,7 +991,7 @@ def _get_binds(self): }, } - binds.update(getattr(settings, 'RTD_DOCKER_ADDITIONAL_BINDS', {})) + binds.update(settings.RTD_DOCKER_ADDITIONAL_BINDS) return binds diff --git a/readthedocs/settings/base.py b/readthedocs/settings/base.py index e6881c42015..471c024c6ff 100644 --- a/readthedocs/settings/base.py +++ b/readthedocs/settings/base.py @@ -488,7 +488,7 @@ def TEMPLATES(self): 'readthedocs/build:latest': DOCKER_IMAGE_SETTINGS.get('readthedocs/build:6.0'), 'readthedocs/build:testing': DOCKER_IMAGE_SETTINGS.get('readthedocs/build:7.0'), }) - # additional binds for the build container + # Additional binds for the build container RTD_DOCKER_ADDITIONAL_BINDS = {} def _get_docker_memory_limit(self):