24 lines
543 B
Docker
24 lines
543 B
Docker
# 构建前端静态产物
|
|
FROM node:22-alpine AS web-build
|
|
|
|
RUN corepack enable
|
|
|
|
WORKDIR /app
|
|
|
|
COPY web/package.json web/pnpm-lock.yaml* ./
|
|
RUN pnpm install --no-frozen-lockfile
|
|
|
|
COPY web ./
|
|
RUN pnpm build
|
|
|
|
# 运行镜像:nginx 托管静态资源并反代 /api
|
|
FROM nginx:1.27-alpine
|
|
|
|
COPY --from=web-build /app/dist /usr/share/nginx/html
|
|
COPY deploy/nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 3000
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
|
CMD wget -qO- http://127.0.0.1:3000/ >/dev/null || exit 1
|