Problem
The Dockerfile contains an UndefinedVar lint warning:
UndefinedVar: Usage of undefined variable '$LD_LIBRARY_PATH'
This occurs in the ENV directive on line 8 of the Dockerfile:
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
FLASK_APP=web_server.py \
PYTHONPATH="/app" \
HF_HOME=/data/huggingface \
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib/python3.13/site-packages/nvidia/cublas/lib:/usr/local/lib/python3.13/site-packages/nvidia/cudnn/lib"
The issue is that $LD_LIBRARY_PATH is referenced in the ENV directive before it has been defined at that point in the Dockerfile. While Docker expands ENV variables at build time, the linter (Hadolint / Docker BuildKit) flags this as an undefined variable reference.
The build still succeeds, but the warning should be resolved.
Proposed Fix
Set LD_LIBRARY_PATH as a separate, self-contained ENV directive before the multi-line one that references it:
ENV LD_LIBRARY_PATH="/usr/local/lib/python3.13/site-packages/nvidia/cublas/lib:/usr/local/lib/python3.13/site-packages/nvidia/cudnn/lib"
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
FLASK_APP=web_server.py \
PYTHONPATH="/app" \
HF_HOME=/data/huggingface
Or alternatively, use the full explicit path in the multi-line env and set it separately.
Severity
Low — the build succeeds and the container runs correctly. The LD_LIBRARY_PATH value is still present in the final image. This is primarily a clean-build warning that should be resolved to keep the Dockerfile linter-clean.
Files
Problem
The Dockerfile contains an
UndefinedVarlint warning:This occurs in the
ENVdirective on line 8 of the Dockerfile:The issue is that
$LD_LIBRARY_PATHis referenced in theENVdirective before it has been defined at that point in the Dockerfile. While Docker expandsENVvariables at build time, the linter (Hadolint/ Docker BuildKit) flags this as an undefined variable reference.The build still succeeds, but the warning should be resolved.
Proposed Fix
Set
LD_LIBRARY_PATHas a separate, self-containedENVdirective before the multi-line one that references it:Or alternatively, use the full explicit path in the multi-line env and set it separately.
Severity
Low — the build succeeds and the container runs correctly. The
LD_LIBRARY_PATHvalue is still present in the final image. This is primarily a clean-build warning that should be resolved to keep the Dockerfile linter-clean.Files
Dockerfileline 8