Skip to content

Commit

Permalink
add private docker registry
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaiPetukhov committed Dec 12, 2023
1 parent 69f1f53 commit 37f8191
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions agent/worker/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
_NO_PROXY = "NO_PROXY"
_PUBLIC_API_RETRY_LIMIT = "PUBLIC_API_RETRY_LIMIT"
_APP_DEBUG_DOCKER_IMAGE = "APP_DEBUG_DOCKER_IMAGE"
_SLY_APPS_DOCKER_REGISTRY = "SLY_APPS_DOCKER_REGISTRY"

_REQUESTS_CA_BUNDLE = "REQUESTS_CA_BUNDLE"
_REQUESTS_CA_BUNDLE_DIR_CONTAINER = "REQUESTS_CA_BUNDLE_DIR_CONTAINER"
Expand Down Expand Up @@ -100,6 +101,7 @@
_GIT_PASSWORD: None,
_GITHUB_TOKEN: None,
_APP_DEBUG_DOCKER_IMAGE: None,
_SLY_APPS_DOCKER_REGISTRY: None,
_REQUESTS_CA_BUNDLE: None,
_SSL_CERT_FILE: None,
_HOST_REQUESTS_CA_BUNDLE: None,
Expand Down Expand Up @@ -526,6 +528,10 @@ def SECURITY_OPT():
return None


def SLY_APPS_DOCKER_REGISTRY():
return read_optional_setting(_SLY_APPS_DOCKER_REGISTRY)


def init_constants():
sly.fs.mkdir(AGENT_LOG_DIR())
sly.fs.mkdir(AGENT_TASKS_DIR())
Expand Down
8 changes: 8 additions & 0 deletions agent/worker/task_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,14 @@ def read_dockerimage_from_config(self):
)
)
self.info["docker_image"] = constants.APP_DEBUG_DOCKER_IMAGE()
if constants.SLY_APPS_DOCKER_REGISTRY() is not None:
self.logger.info(
"NON DEFAULT DOCKER REGISTRY: docker image {!r} is replaced to {!r}".format(
self.info["docker_image"], f"{constants.SLY_APPS_DOCKER_REGISTRY()}/{self.info['docker_image']}"
)
)
self.info["docker_image"] = f"{constants.SLY_APPS_DOCKER_REGISTRY()}/{self.info['docker_image']}"

except KeyError as e:
requirements_path = self.get_requirements_path()
version = "latest"
Expand Down

0 comments on commit 37f8191

Please sign in to comment.