fix: prevent false GPU detection when CUDA image runs without GPU

The STIRLING_GPU=true env var was baked into the :cuda Dockerfile,
which made gpu_available() return True without checking actual
hardware. On machines without a GPU, this would crash upscale.py
(torch.device("cuda") fails) and ocr.py (PaddleOCR use_gpu=True).

Fix: the env var can only disable GPU (set to false/0), never
force-enable it. Hardware detection always runs. Removed the
baked env var from the Dockerfile since it adds no value now.
This commit is contained in:
Siddharth Kumar Sah
2026-04-05 22:03:57 +08:00
parent 609fd57de8
commit a291d1fe0b
2 changed files with 8 additions and 4 deletions
+1 -2
View File
@@ -190,8 +190,7 @@ ENV PORT=1349 \
CONCURRENT_JOBS=3 \
MAX_MEGAPIXELS=100 \
RATE_LIMIT_PER_MIN=100 \
STIRLING_VARIANT=${VARIANT} \
STIRLING_GPU=${GPU}
STIRLING_VARIANT=${VARIANT}
# Create non-root user for runtime
RUN groupadd -r stirling && useradd -r -g stirling -d /app -s /sbin/nologin stirling