front/Dockerfile.k3s
xiaolipro 7c29005cb6
All checks were successful
Build and Deploy Front / deploy (push) Successful in 7m17s
feat: cicd for test
2026-09-22 16:09:09 +08:00

19 lines
872 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.

# k3s / Kaniko:静态 SPA(方案 A)。API 由浏览器按站点域名直连
# app.test.ideship.com → api.test.ideship.com;其余 → api.ideship.com
# 镜像内 nginx 不做反代;也可用构建期 VITE_API_ORIGIN / VITE_API_ADMIN_URL 覆盖
FROM docker.m.daocloud.io/library/node:20-alpine AS build
WORKDIR /app
RUN npm config set registry https://registry.npmmirror.com \
&& npm install -g pnpm@9.15.9
COPY package.json pnpm-lock.yaml ./
# --ignore-scripts:跳过 gifsicle/optipng 等原生编译(需 autoreconf;vite 未启用 imagemin)
RUN pnpm config set registry https://registry.npmmirror.com \
&& pnpm install --frozen-lockfile --ignore-scripts
COPY . .
RUN pnpm run build
FROM docker.m.daocloud.io/library/nginx:1.27-alpine
COPY --from=build /app/dist /usr/share/nginx/html/
COPY nginx-k3s.conf /etc/nginx/conf.d/default.conf
EXPOSE 80