ci(docker): 使用nvm替代直接运行node容器构建
Some checks failed
site-dist-deploy / build-and-deploy (push) Failing after 2s

修改docker构建流程,通过nvm安装并使用node 20,替代直接运行node容器的方式
This commit is contained in:
shanshanzhong 2026-01-04 00:56:14 -08:00
parent 5082885ace
commit d687e47fdc

View File

@ -39,12 +39,20 @@ jobs:
- name: Build dist in Node container - name: Build dist in Node container
run: | run: |
docker run --rm -v "$PWD":/app -w /app node:20 bash -lc ' set -e
npm ci export NVM_DIR="$HOME/.nvm"
echo "VITE_APP_BASE_URL=${VITE_APP_BASE_URL}" > .env.pord if [ ! -d "$NVM_DIR" ]; then
npm run build:prod curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
tar -C dist -czf site_dist.tgz . fi
' . "$NVM_DIR/nvm.sh"
nvm install 20
nvm use 20
node -v
npm -v
npm ci
echo "VITE_APP_BASE_URL=${VITE_APP_BASE_URL}" > .env.pord
npm run build:prod
tar -C dist -czf site_dist.tgz .
- name: Prepare target directory - name: Prepare target directory
uses: appleboy/ssh-action@v1.0.3 uses: appleboy/ssh-action@v1.0.3