feat(frontend): inject commit ID into frontend build for version tracking
- Added a new build argument `COMMIT_ID_ARG` to pass the commit ID during the Docker build process. - Updated the Dockerfile to set an environment variable `VITE_FRONTEND_COMMIT` with the commit ID. - Enhanced the Vite configuration to resolve the frontend commit ID from the environment or Git. - Modified the SystemInfo component to display the frontend commit ID in the UI. - Implemented a version info preparation step in the GitHub Actions workflow to capture the commit ID.
This commit is contained in:
@@ -7,6 +7,10 @@ WORKDIR /app
|
||||
ENV NODE_OPTIONS="--max-old-space-size=4096"
|
||||
ENV VITE_IS_DOCKER=true
|
||||
|
||||
# 注入前端 commit hash(构建上下文为 frontend/,无 .git,故通过构建参数传入)
|
||||
ARG COMMIT_ID_ARG=unknown
|
||||
ENV VITE_FRONTEND_COMMIT=${COMMIT_ID_ARG}
|
||||
|
||||
# 复制依赖文件
|
||||
COPY package*.json ./
|
||||
COPY pnpm-workspace.yaml ./
|
||||
|
||||
Reference in New Issue
Block a user