Skip to content

Commit 880d989

Browse files
committed
fix(docker): quiet apt/debconf noise and add progress to piguard model download
The export container now runs with DEBIAN_FRONTEND=noninteractive to silence TTY/debconf warnings, suppresses the git detached-HEAD advice, and prints progress messages for the long pip install and ONNX export steps.
1 parent a88df7c commit 880d989

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

docker/piguard/download-model.sh

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,39 @@ echo "Output directory: ${MODEL_DIR}"
2222
# Run the export in a disposable Python container so no host Python/toolchain is
2323
# required. The guard repo's export_onnx.py downloads the model from HuggingFace
2424
# and converts it to ONNX.
25+
#
26+
# DEBIAN_FRONTEND=noninteractive keeps apt-get quiet on headless hosts.
27+
# GIT_CONFIG_GLOBAL turns off the detached-HEAD advice and clone progress spam.
2528
docker run --rm \
2629
-v "${MODEL_DIR}:/out" \
2730
-e HF_HOME=/tmp \
31+
-e DEBIAN_FRONTEND=noninteractive \
32+
-e GIT_CONFIG_GLOBAL=/tmp/.gitconfig \
2833
python:3.12-slim bash -c "
2934
set -euo pipefail
30-
apt-get update >/dev/null
31-
apt-get install -y --no-install-recommends git curl ca-certificates >/dev/null
32-
git clone --depth 1 --branch '${PIGUARD_REF}' \
35+
36+
# Silence git advice / progress noise inside the container.
37+
printf '[advice]\ndetachedHead = false\n' > /tmp/.gitconfig
38+
39+
echo '==> Installing git and curl inside container...'
40+
apt-get -qq update
41+
apt-get -qq install -y --no-install-recommends git curl ca-certificates >/dev/null
42+
43+
echo '==> Cloning go-prompt-injection-guard (${PIGUARD_REF})...'
44+
git clone --quiet --depth 1 --branch '${PIGUARD_REF}' \
3345
https://github.com/BackendStack21/go-prompt-injection-guard.git /src
46+
3447
cd /src
35-
pip install --no-cache-dir -r scripts/requirements.txt >/dev/null
36-
python scripts/export_onnx.py
48+
49+
echo '==> Installing Python export requirements (this may take a minute)...'
50+
pip install --no-cache-dir --quiet -r scripts/requirements.txt
51+
52+
echo '==> Exporting PIGuard model from HuggingFace to ONNX (~735 MB, be patient)...'
53+
python -u scripts/export_onnx.py
54+
55+
echo '==> Copying exported model to host volume...'
3756
cp ~/.cache/piguard/onnx/* /out/
57+
chmod 644 /out/*
3858
"
3959

4060
echo "Done. Model files written to ${MODEL_DIR}:"

0 commit comments

Comments
 (0)