From 1203719eac30a7df6222d424c342fa12cd9cc3fe Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Fri, 29 Aug 2025 13:28:12 +1000 Subject: [PATCH] fix: Docker python version and fix reporting missing requirements --- Dockerfile | 7 +++---- account.py | 46 +++++++++++++++++++++++++++------------------- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0a627cf..31dcc5f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ -FROM --platform=$BUILDPLATFORM python:3.10-alpine AS builder +FROM --platform=$BUILDPLATFORM python:3.13-alpine AS builder WORKDIR /app - +RUN apk add git openssl curl COPY requirements.txt /app RUN --mount=type=cache,target=/root/.cache/pip \ pip3 install -r requirements.txt @@ -10,9 +10,8 @@ COPY . /app # Add mount point for data volume # VOLUME /data -RUN apk add git openssl curl ENTRYPOINT ["python3"] CMD ["server.py"] -FROM builder as dev-envs +FROM builder AS dev-envs diff --git a/account.py b/account.py index 1f9db87..a9612e5 100644 --- a/account.py +++ b/account.py @@ -1784,25 +1784,34 @@ def checkPreRequisites() -> dict[str, bool]: "git": False, "hsd": False } + + try: + # Check if node is installed and get version + nodeSubprocess = subprocess.run(["node", "-v"], capture_output=True, text=True) + if nodeSubprocess.returncode == 0: + major_version = int(nodeSubprocess.stdout.strip().lstrip('v').split('.')[0]) + if major_version >= HSD_CONFIG.get("minNodeVersion", 20): + prerequisites["node"] = True + except FileNotFoundError: + pass - # Check if node is installed and get version - nodeSubprocess = subprocess.run(["node", "-v"], capture_output=True, text=True) - if nodeSubprocess.returncode == 0: - major_version = int(nodeSubprocess.stdout.strip().lstrip('v').split('.')[0]) - if major_version >= HSD_CONFIG.get("minNodeVersion", 20): - prerequisites["node"] = True + try: + # Check if npm is installed + npmSubprocess = subprocess.run(["npm", "-v"], capture_output=True, text=True) + if npmSubprocess.returncode == 0: + major_version = int(npmSubprocess.stdout.strip().split('.')[0]) + if major_version >= HSD_CONFIG.get("minNPMVersion", 8): + prerequisites["npm"] = True + except FileNotFoundError: + pass - # Check if npm is installed - npmSubprocess = subprocess.run(["npm", "-v"], capture_output=True, text=True) - if npmSubprocess.returncode == 0: - major_version = int(npmSubprocess.stdout.strip().split('.')[0]) - if major_version >= HSD_CONFIG.get("minNPMVersion", 8): - prerequisites["npm"] = True - - # Check if git is installed - gitSubprocess = subprocess.run(["git", "-v"], capture_output=True, text=True) - if gitSubprocess.returncode == 0: - prerequisites["git"] = True + try: + # Check if git is installed + gitSubprocess = subprocess.run(["git", "-v"], capture_output=True, text=True) + if gitSubprocess.returncode == 0: + prerequisites["git"] = True + except FileNotFoundError: + pass # Check if hsd is installed if os.path.exists("./hsd/bin/hsd"): @@ -1832,7 +1841,7 @@ def hsdInit(): for key, value in prerequisites.items(): if not value: print(f" - {key} is missing or does not meet the version requirement.") - exit(1) + exit(1) return # Check if hsd is installed @@ -1958,7 +1967,6 @@ def hsdRestart(): hsdStart() -checkPreRequisites() hsdInit() hsdStart() # endregion \ No newline at end of file