chore: update entrypoint.sh started speed

This commit is contained in:
engigu
2026-01-04 09:01:02 +08:00
parent 532c37e336
commit 97cd3c4367
+32 -20
View File
@@ -17,31 +17,43 @@ mkdir -p \
"$NODE_ENV_DIR" "$NODE_ENV_DIR"
# ============================ # ============================
# Python 虚拟环境 # Python 虚拟环境(后台并行)
# ============================ # ============================
if [ ! -x "$PYTHON_VENV_DIR/bin/python" ]; then (
echo "[entrypoint] Creating Python virtual environment..." if [ ! -x "$PYTHON_VENV_DIR/bin/python" ]; then
python3 -m venv "$PYTHON_VENV_DIR" echo "[entrypoint] Creating Python virtual environment..."
"$PYTHON_VENV_DIR/bin/pip" config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple python3 -m venv "$PYTHON_VENV_DIR"
"$PYTHON_VENV_DIR/bin/pip" install --upgrade pip setuptools wheel "$PYTHON_VENV_DIR/bin/pip" config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
else "$PYTHON_VENV_DIR/bin/pip" install --upgrade pip setuptools wheel
echo "[entrypoint] Python venv exists" echo "[entrypoint] Python venv created"
fi else
echo "[entrypoint] Python venv exists"
fi
) &
PYTHON_PID=$!
# ============================ # ============================
# Node 环境(npm prefix # Node 环境(后台并行
# ============================ # ============================
echo "[entrypoint] Initializing Node npm prefix..." (
echo "[entrypoint] Initializing Node npm prefix..."
# npm 全局安装目录 → /app/envs/node
npm config set prefix "$NODE_ENV_DIR"
# npm 行为优化(防内存暴涨)
npm config set registry https://registry.npmmirror.com
npm config set audit false
npm config set fund false
npm config set progress false
npm config set maxsockets 2
echo "[entrypoint] Node npm configured"
) &
NODE_PID=$!
# npm 全局安装目录 → /app/envs/node # 等待两个后台任务完成
npm config set prefix "$NODE_ENV_DIR" echo "[entrypoint] Waiting for environment initialization..."
wait $PYTHON_PID
# npm 行为优化(防内存暴涨) wait $NODE_PID
npm config set registry https://registry.npmmirror.com echo "[entrypoint] Environment initialization completed"
npm config set audit false
npm config set fund false
npm config set progress false
npm config set maxsockets 2
# Node 内存限制 # Node 内存限制
export NODE_OPTIONS="--max-old-space-size=256" export NODE_OPTIONS="--max-old-space-size=256"