xiaoai/php_pc/Dockerfile

41 lines
1.0 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ────────────────────
# 第一步:构建阶段
# ────────────────────
FROM node:20 AS builder
WORKDIR /app
COPY package*.json yarn.lock ./
COPY .env .
RUN yarn install --frozen-lockfile
COPY . .
RUN yarn build
# # ────────────────────
# # 第二步:运行阶段
# # ────────────────────
# FROM node:20-slim AS runtime
# WORKDIR /app
# # 拷贝构建产物
# COPY --from=builder /app/.output .output
# COPY --from=builder /app/node_modules ./node_modules
# # 只拷贝必要的运行文件(不执行 yarn install
# # 如果 Nuxt 构建产物已完整,可不再安装依赖
# # COPY package*.json yarn.lock ./
# # RUN yarn install --production --frozen-lockfile
# # ✅ 安装 serve 用于启动 SSR 服务
# RUN npm install -g serve
# # 暴露端口
# EXPOSE 8091
# # 启动 Nuxt SSR 服务
# # CMD ["node", ".output/server/index.mjs"]
CMD ["bash"]