4967891d8b
CI/CD Pipeline / Check if frontend-only change (push) Has been cancelled
CI/CD Pipeline / Validate - Code Quality (push) Has been cancelled
CI/CD Pipeline / Validate - Type Check (mypy) (push) Has been cancelled
CI/CD Pipeline / Validate - Migration (alembic) (push) Has been cancelled
CI/CD Pipeline / Unit Tests (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Frontend Lint (push) Has been cancelled
CI/CD Pipeline / Frontend Unit Tests (push) Has been cancelled
CI/CD Pipeline / PR Build API Image (push) Has been cancelled
CI/CD Pipeline / PR Build Web Image (push) Has been cancelled
CI/CD Pipeline / PR Build Worker Image (push) Has been cancelled
CI/CD Pipeline / Build Staging API Image (push) Has been cancelled
CI/CD Pipeline / Build Staging Web Image (push) Has been cancelled
CI/CD Pipeline / Build Staging Worker Image (push) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (push) Has been cancelled
CI/CD Pipeline / Staging API Integration Tests (push) Has been cancelled
CI/CD Pipeline / Build Production API Image (push) Has been cancelled
CI/CD Pipeline / Build Production Web Image (push) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (push) Has been cancelled
CI/CD Pipeline / Deploy Production (push) Has been cancelled
CI/CD Pipeline / Production Browser E2E (push) Has been cancelled
CI/CD Pipeline / ACR Image Cleanup (push) Has been cancelled
27 lines
980 B
Bash
Executable File
27 lines
980 B
Bash
Executable File
#!/bin/sh
|
|
# CI 公共步骤:前端命令执行(在 docker node 容器中运行)
|
|
# 用法:step_frontend_run.sh "要执行的命令"
|
|
# 支持 Docker Volume 持久化缓存的 node_modules
|
|
set -eu
|
|
|
|
CMD="${1:-echo 'no command'}"
|
|
|
|
# 缓存配置 — 与 step_frontend_install.sh 保持一致
|
|
LOCK_FILE="apps/web/package-lock.json"
|
|
VOLUME_PREFIX="ci-web-nm-"
|
|
|
|
# 计算 package-lock.json 的 hash,挂载对应的 volume
|
|
VOLUME_ARGS=""
|
|
if [ -f "$LOCK_FILE" ]; then
|
|
LOCK_HASH=$(md5sum "$LOCK_FILE" | cut -c1-12)
|
|
VOLUME_NAME="${VOLUME_PREFIX}${LOCK_HASH}"
|
|
if docker volume inspect "$VOLUME_NAME" >/dev/null 2>&1; then
|
|
VOLUME_ARGS="-v ${VOLUME_NAME}:/workspace/apps/web/node_modules"
|
|
echo "使用缓存 volume: $VOLUME_NAME"
|
|
else
|
|
echo "提示: 未找到缓存 volume $VOLUME_NAME,将使用源码目录 node_modules"
|
|
fi
|
|
fi
|
|
|
|
docker run --rm -v "$PWD:/workspace" $VOLUME_ARGS -w /workspace/apps/web docker.m.daocloud.io/library/node:20 sh -lc "$CMD"
|