18 lines
756 B
Docker
18 lines
756 B
Docker
# k3s / Kaniko:静态 SPA(方案 A)。API 直连 api.ideship.com,镜像内 nginx 不做反代
|
||
# 基础镜像走 DaoCloud,避免 Kaniko 直连 docker.io 超时
|
||
FROM docker.m.daocloud.io/library/node:20-alpine AS build
|
||
WORKDIR /app
|
||
# 不用 corepack(要求 packageManager 带版本且在部分环境易挂),直接装 pnpm
|
||
RUN npm config set registry https://registry.npmmirror.com \
|
||
&& npm install -g pnpm@9.15.9
|
||
COPY package.json pnpm-lock.yaml ./
|
||
RUN pnpm config set registry https://registry.npmmirror.com \
|
||
&& pnpm install --frozen-lockfile
|
||
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
|