chore: update entrypoint.sh started speed

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