vite.config.ts reads engines.node from ../gitnexus/package.json, but Dockerfile.web only copied gitnexus-shared and gitnexus-web, causing the build to fail with "Cannot find module" during `npm run build --prefix gitnexus-web`. Co-authored-by: wangjichao <wangjichao@inke.cn>
38 lines
799 B
Docker
38 lines
799 B
Docker
ARG BUILDPLATFORM
|
|
ARG TARGETPLATFORM
|
|
|
|
FROM --platform=$BUILDPLATFORM node:22-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY gitnexus-shared/package.json gitnexus-shared/package-lock.json ./gitnexus-shared/
|
|
RUN npm ci --prefix gitnexus-shared
|
|
|
|
COPY gitnexus-shared ./gitnexus-shared
|
|
RUN npm run build --prefix gitnexus-shared
|
|
|
|
COPY gitnexus/package.json ./gitnexus/
|
|
|
|
COPY gitnexus-web/package.json gitnexus-web/package-lock.json ./gitnexus-web/
|
|
RUN npm ci --prefix gitnexus-web
|
|
|
|
COPY gitnexus-web ./gitnexus-web
|
|
RUN npm run build --prefix gitnexus-web
|
|
|
|
FROM node:22-alpine AS runtime
|
|
|
|
RUN apk add --no-cache curl
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /app/gitnexus-web/dist ./dist
|
|
COPY docker-server.mjs ./docker-server.mjs
|
|
|
|
RUN chown -R node:node /app
|
|
|
|
USER node
|
|
|
|
EXPOSE 4173
|
|
|
|
CMD ["node", "docker-server.mjs"]
|