Files
estel_docs/Dockerfile
estel 64a91ccf7c
Some checks failed
CI / lint (push) Has been cancelled
CI / typecheck (push) Has been cancelled
CI / build (macos-latest) (push) Has been cancelled
CI / build (ubuntu-latest) (push) Has been cancelled
CI / build (windows-latest) (push) Has been cancelled
CI / generate (macos-latest) (push) Has been cancelled
CI / generate (ubuntu-latest) (push) Has been cancelled
CI / generate (windows-latest) (push) Has been cancelled
Publish Any Commit / publish (push) Has been cancelled
docker更新
2025-07-29 02:21:39 +08:00

38 lines
1.1 KiB
Docker
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ------------- 依赖缓存阶段 -------------
FROM node:22.16-alpine AS base
# 国内镜像
RUN npm config set registry https://registry.npmmirror.com
WORKDIR /app
# 1⃣ 先把锁文件拷进来,让这一层可以 cache
COPY package.json pnpm-lock.yaml ./
# 2⃣ 再执行安装
RUN corepack enable && pnpm install --frozen-lockfile
# 3⃣ 再拷剩余源码
COPY . .
RUN chmod +x patch-ui-pro.zsh && ./patch-ui-pro.zsh
# ------------- 构建阶段 -------------
FROM base AS builder
RUN pnpm build
# ------------- 运行阶段 -------------
FROM node:22.16-alpine AS production
WORKDIR /app
# 拷贝 lock + package.json 用于安装 prod 依赖
COPY --from=builder /app/package.json /app/pnpm-lock.yaml ./
RUN corepack enable && pnpm install --frozen-lockfile --prod
# 拷贝构建产物
COPY --from=builder /app/.output ./.output
EXPOSE 3000
ENV NODE_ENV=production HOST=0.0.0.0 PORT=3000
CMD ["node", ".output/server/index.mjs"]