This commit is contained in:
parent
9f0a053e96
commit
a6c04a18c8
|
|
@ -0,0 +1,24 @@
|
|||
# 第一步:编译阶段
|
||||
FROM node:20 AS builder
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 拷贝依赖文件并安装
|
||||
COPY package*.json yarn.lock ./
|
||||
RUN yarn install --frozen-lockfile
|
||||
|
||||
# 拷贝源码
|
||||
COPY . .
|
||||
|
||||
# 打包(构建 Nuxt 项目)
|
||||
RUN yarn build
|
||||
|
||||
# 第二步:导出产物阶段(可选用于提取)
|
||||
FROM alpine:3.18 AS export
|
||||
|
||||
WORKDIR /export
|
||||
COPY --from=builder /app/.output .output
|
||||
|
||||
# 你也可以选择只拷贝 .output/public 目录
|
||||
# COPY --from=builder /app/.output/public public
|
||||
Loading…
Reference in New Issue