Deploy Resume / deploy (push) Successful in 45s
pnpm 11 要求 Node >= 22.13,node:20-alpine 无法运行
31 lines
848 B
Docker
31 lines
848 B
Docker
# ---- 构建阶段:由 data/ + templates/ 生成静态站点 ----
|
||
FROM node:22-alpine AS build
|
||
WORKDIR /app
|
||
|
||
# 跳过 Playwright 浏览器下载(构建无需浏览器)
|
||
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
|
||
|
||
# 国内镜像安装依赖(CI runner 在阿里云);pnpm 版本与本地生成 lockfile 的一致
|
||
RUN npm install -g pnpm@11.28.5 --registry=https://registry.npmmirror.com
|
||
|
||
COPY package.json pnpm-lock.yaml .npmrc ./
|
||
RUN pnpm install --frozen-lockfile
|
||
|
||
COPY . .
|
||
RUN node scripts/build.mjs && node scripts/check.mjs
|
||
|
||
# ---- 运行阶段:Nginx 托管 dist/ ----
|
||
FROM nginx:alpine
|
||
|
||
# 复制 Nginx 配置
|
||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||
|
||
# 复制构建产物(HTML + txt + css + img)
|
||
COPY --from=build /app/dist/ /usr/share/nginx/html/
|
||
|
||
# 暴露端口
|
||
EXPOSE 80
|
||
|
||
# 启动 Nginx
|
||
CMD ["nginx", "-g", "daemon off;"]
|