npm ci in the images ran without frontend/.npmrc, so the eslint 9/10 peer conflict aborted it (legacy-peer-deps=true lives in .npmrc). The release build stage also used alpine/musl, where npm ci skipped the rolldown native bindings and vite build failed; build on glibc like dev instead.
14 lines
507 B
Docker
14 lines
507 B
Docker
FROM node:22 AS build
|
|
WORKDIR /src
|
|
COPY frontend/package.json frontend/package-lock.json frontend/.npmrc ./
|
|
RUN npm ci
|
|
COPY frontend/ ./
|
|
RUN npm run build
|
|
|
|
FROM nginx:1.27-alpine AS runner
|
|
COPY --chmod=755 deploy/entrypoint-resolver.sh /entrypoint-resolver.sh
|
|
COPY --from=build /src/dist /usr/share/nginx/html
|
|
# nginx 配置不 bake 进镜像:由 compose 挂到 /etc/booklib/(渲染产物),
|
|
# entrypoint 启动时拷入原位、注入运行时 resolver 再 exec nginx
|
|
ENTRYPOINT ["/entrypoint-resolver.sh"]
|