From dd50ccc1a922df555c3ba4294ff19b51bc38765b Mon Sep 17 00:00:00 2001 From: llm Date: Sat, 22 Nov 2025 21:34:57 +0100 Subject: [PATCH] Use env var for Python app executed in container --- bin/create_pod_pytorch.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/create_pod_pytorch.sh b/bin/create_pod_pytorch.sh index a5ab44f..339a42c 100755 --- a/bin/create_pod_pytorch.sh +++ b/bin/create_pod_pytorch.sh @@ -19,15 +19,14 @@ PYTORCH_HOST_PORT='8086' PYTORCH_CONTAINER_PORT='8000' BIND_DIR="$HOME/.local/share/$POD_NAME" AI_MODELS_DIR="$BIND_DIR/ai-models" -PYTHON_APPS_DIR="$BIND_DIR/python-apps" +HOST_PYTHON_APPS_DIR="$BIND_DIR/python-apps" +# Python app inside container to be executed +CTR_PY_APP="/python-apps/embed-multimodal-7b.py" USER_SYSTEMD_DIR="$HOME/.config/systemd/user" CONTAINERFILE="$BIND_DIR/containerfile" -PY_APP="$PYTHON_APPS_DIR/embed-multimodal-7b.py" - -echo "$PY_APP" # Prepare directories -mkdir -p "$AI_MODELS_DIR" "$PYTHON_APPS_DIR" "$USER_SYSTEMD_DIR" +mkdir -p "$AI_MODELS_DIR" "$HOST_PYTHON_APPS_DIR" "$USER_SYSTEMD_DIR" # Generate containerfile cat >"$CONTAINERFILE" <<'EOF' @@ -39,7 +38,7 @@ FROM ${BASE_IMAGE} # Hugging Face caches and Python apps directory (bind-mounted at runtime) ENV HF_HOME=/models/hf \ TRANSFORMERS_CACHE=/models/hf/transformers \ - PYTHON_APPS_DIR=/python-apps + HOST_PYTHON_APPS_DIR=/python-apps # Ensure directories exist RUN mkdir -p /models/hf/transformers /python-apps @@ -101,10 +100,11 @@ podman run -d --name "$CTR_NAME" --pod "$POD_NAME" \ -e HF_MODEL_ID="$HF_MODEL_ID" \ -e HF_MODEL_URL="$HF_MODEL_URL" \ -e PYTORCH_CONTAINER_PORT="$PYTORCH_CONTAINER_PORT" \ + -e CTR_PY_APP="$CTR_PY_APP" \ -v "$AI_MODELS_DIR":/models \ - -v "$PYTHON_APPS_DIR":/python-apps \ + -v "$HOST_PYTHON_APPS_DIR":/python-apps \ "$CUSTOM_IMAGE" \ - python /python-apps/embed-multimodal-7b.py + python "$CTR_PY_APP" # Wait for API readiness (/health) HEALTH_URL="http://$HOST_LOCAL_IP:$PYTORCH_HOST_PORT/health"