fix(ci): volume mount 不可 rm -rf,改 find -mindepth 1 -delete
Some checks failed
CD Pipeline / build-and-deploy (push) Failing after 2m41s

/opt/api-venv 是 Docker volume mount,刪目錄本身會 Device or resource busy
改清空內容保留 mount point

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-04-17 12:26:37 +08:00
parent b7c2b691bb
commit ce731c8ceb

View File

@@ -102,9 +102,11 @@ jobs:
ln -sf "$(which python3)" /usr/local/bin/python3.11 || true
fi
if [ ! -d "$VENV" ] || [ "$(cat $HASH_FILE 2>/dev/null)" != "$CURRENT_HASH" ]; then
if [ ! -d "$VENV/bin" ] || [ "$(cat $HASH_FILE 2>/dev/null)" != "$CURRENT_HASH" ]; then
echo "📦 deps 已變更,重建 venv..."
rm -rf "$VENV"
# 2026-04-17 ogt: /opt/api-venv 是 volume mount不能 rm -rf 目錄本身
# 改用 find 清空內容,保留 mount point 目錄
find "$VENV" -mindepth 1 -delete 2>/dev/null || true
python3.11 -m venv $VENV
source $VENV/bin/activate
pip install -q uv