Update
Browse files12 unmodified lines131415161718192021222324252627282930311 unmodified line3334353637383912 unmodified lines# ---------- app user ----------RUN groupadd -r appuser && useradd -m -r -g appuser -s /bin/bash appuserUSER appuser # ←─── switch early!# ---------- directories & env ----------ENV HOME=/home/appuserENV \# Hugging-Face / transformers cachesHF_HOME=$HOME/.cache \HF_HUB_CACHE=$HOME/.cache/hub \HUGGINGFACE_HUB_CACHE=$HOME/.cache/hub \TRANSFORMERS_CACHE=$HOME/.cache/huggingface/hub \# uv’s compilation / wheel cacheUV_CACHE_DIR=$HOME/.cache/uv \# python / app settingsPYTHONUNBUFFERED=1 \PYTHONDONTWRITEBYTECODE=1 \UV_SYSTEM_PYTHON=1 \1 unmodified linePORT=${PORT} \TRANSPORT_SERVER_URL=${TRANSPORT_SERVER_URL}RUN mkdir -p "$HF_HUB_CACHE" "$TRANSFORMERS_CACHE" "$UV_CACHE_DIR"# ---------- workdir ----------WORKDIR /app12 unmodified lines1314151617181920212223242526271 unmodified line29303132333435363738394012 unmodified lines# ---------- app user ----------RUN groupadd -r appuser && useradd -m -r -g appuser -s /bin/bash appuser# ---------- cache directories & environment ----------ENV HOME=/home/appuserENV \HF_HOME=$HOME/.cache \HF_HUB_CACHE=$HOME/.cache/hub \HUGGINGFACE_HUB_CACHE=$HOME/.cache/hub \TRANSFORMERS_CACHE=$HOME/.cache/huggingface/hub \UV_CACHE_DIR=$HOME/.cache/uv \PYTHONUNBUFFERED=1 \PYTHONDONTWRITEBYTECODE=1 \UV_SYSTEM_PYTHON=1 \1 unmodified linePORT=${PORT} \TRANSPORT_SERVER_URL=${TRANSPORT_SERVER_URL}# create the caches while still root, then chown to appuserRUN mkdir -p "$HF_HUB_CACHE" "$TRANSFORMERS_CACHE" "$UV_CACHE_DIR" \&& chown -R appuser:appuser "$HOME/.cache"# switch to non-root user (no inline comment!)USER appuser# ---------- workdir ----------WORKDIR /app
Dockerfile+7-6