From a535ca31a8ae99e9c2bda8f09346ef062afe27ab Mon Sep 17 00:00:00 2001 From: Adrian Priestley <47989725+a-priestley@users.noreply.github.com> Date: Sat, 19 Jul 2025 11:18:30 -0230 Subject: [PATCH] Dockerfile/Core: Prevent module update during container runtime (#5205) * fix(env): Prevent module update during requirements processing - Add environment variable SKIP_REQUIREMENTS_UPDATE check - Ensure update is skipped if SKIP_REQUIREMENTS_UPDATE is set to true * squash! fix(env): Prevent module update during requirements processing - Add environment variable SKIP_REQUIREMENTS_UPDATE check - Ensure update is skipped if SKIP_REQUIREMENTS_UPDATE is set to true --- Dockerfile | 1 + ModuleUpdate.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0ed61c03..c6d22a4f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -94,4 +94,5 @@ RUN if [ "$TARGETARCH" = "amd64" ]; then \ HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ CMD curl -f http://localhost:${PORT:-80} || exit 1 +ENV SKIP_REQUIREMENTS_UPDATE=true ENTRYPOINT [ "python", "WebHost.py" ] diff --git a/ModuleUpdate.py b/ModuleUpdate.py index 04cf25ea..e6ac570e 100644 --- a/ModuleUpdate.py +++ b/ModuleUpdate.py @@ -16,7 +16,11 @@ elif sys.version_info < (3, 10, 1): raise RuntimeError(f"Incompatible Python Version found: {sys.version_info}. 3.10.1+ is supported.") # don't run update if environment is frozen/compiled or if not the parent process (skip in subprocess) -_skip_update = bool(getattr(sys, "frozen", False) or multiprocessing.parent_process()) +_skip_update = bool( + getattr(sys, "frozen", False) or + multiprocessing.parent_process() or + os.environ.get("SKIP_REQUIREMENTS_UPDATE", "").lower() in ("1", "true", "yes") +) update_ran = _skip_update