ci: add test environment client deployment
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
# 构建 Vue 静态文件
|
||||
FROM node:22-alpine AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Corepack 与 pnpm 依赖均通过 npmmirror 下载,避免构建时访问 npm 官方源过慢。
|
||||
ENV COREPACK_NPM_REGISTRY=https://registry.npmmirror.com
|
||||
ENV NPM_CONFIG_REGISTRY=https://registry.npmmirror.com
|
||||
RUN corepack enable
|
||||
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
COPY shared/package.json ./shared/package.json
|
||||
|
||||
# package.json 和 lock 文件未变化时,这一层会由 Docker 自动复用。
|
||||
RUN pnpm config set registry https://registry.npmmirror.com && \
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
COPY . .
|
||||
RUN pnpm test && pnpm build
|
||||
|
||||
# 运行阶段仅保留构建产物与 Nginx。
|
||||
FROM nginx:1.27-alpine
|
||||
|
||||
COPY nginx/default.conf.template /etc/nginx/templates/default.conf.template
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
|
||||
EXPOSE 80
|
||||
Reference in New Issue
Block a user