This commit is contained in:
parent
a6c04a18c8
commit
dace1f9d85
|
|
@ -0,0 +1,22 @@
|
|||
# 构建阶段
|
||||
FROM node:20 AS builder
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 拷贝依赖文件并安装
|
||||
COPY package*.json yarn.lock ./
|
||||
RUN yarn install --frozen-lockfile
|
||||
|
||||
# 拷贝源代码
|
||||
COPY . .
|
||||
|
||||
# 构建生产环境代码
|
||||
RUN yarn build
|
||||
|
||||
# 导出阶段
|
||||
FROM alpine:3.18 AS export
|
||||
WORKDIR /export
|
||||
|
||||
# 仅导出编译产物
|
||||
COPY --from=builder /app/dist ./dist
|
||||
Loading…
Reference in New Issue