Files
zkxw/deploy/docker/web-admin/Dockerfile
T
2026-06-03 17:53:48 +08:00

29 lines
846 B
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.
# 基础镜像走 DaoCloud(避免 docker.1ms.run 等加速站缺 node/nginx manifest)
ARG NODE_IMAGE=docker.m.daocloud.io/library/node:20-alpine
ARG NGINX_IMAGE=docker.m.daocloud.io/library/nginx:1.27-alpine
FROM ${NODE_IMAGE} AS builder
ARG NPM_REGISTRY=https://registry.npmmirror.com
RUN corepack enable && corepack prepare pnpm@9.15.4 --activate
WORKDIR /app
COPY web-admin/package.json web-admin/pnpm-lock.yaml ./
RUN pnpm config set registry "${NPM_REGISTRY}" \
&& pnpm install --frozen-lockfile
COPY web-admin/ .
RUN pnpm exec vite build --mode docker
FROM ${NGINX_IMAGE}
COPY deploy/docker/nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD wget -qO- http://127.0.0.1/ || exit 1