plan/react-rewrite #1
@@ -0,0 +1,32 @@
|
||||
# Dockerfile.react — Multi-stage build for standalone SSR server
|
||||
# Coexists with the legacy ASP.NET Dockerfile
|
||||
|
||||
# Stage 1: Install dependencies
|
||||
FROM node:24-slim AS deps
|
||||
WORKDIR /app
|
||||
|
||||
RUN corepack enable pnpm
|
||||
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# Stage 2: Build standalone target
|
||||
FROM deps AS build
|
||||
WORKDIR /app
|
||||
|
||||
COPY modern.config.ts module-federation.config.ts tsconfig.json ./
|
||||
COPY src/ src/
|
||||
|
||||
RUN pnpm build:standalone
|
||||
|
||||
# Stage 3: Minimal production image
|
||||
FROM node:24-slim AS runtime
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
COPY --from=build /app/dist/standalone/ ./dist/standalone/
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["node", "dist/standalone/index.js"]
|
||||
@@ -0,0 +1,28 @@
|
||||
# Dockerfile.remote — nginx-based static file server for remote MF artifact
|
||||
|
||||
# Stage 1: Install dependencies
|
||||
FROM node:24-slim AS deps
|
||||
WORKDIR /app
|
||||
|
||||
RUN corepack enable pnpm
|
||||
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# Stage 2: Build remote target
|
||||
FROM deps AS build
|
||||
WORKDIR /app
|
||||
|
||||
COPY modern.config.ts module-federation.config.ts tsconfig.json ./
|
||||
COPY src/ src/
|
||||
|
||||
RUN pnpm build:remote
|
||||
|
||||
# Stage 3: Serve static files with nginx
|
||||
FROM nginx:alpine AS runtime
|
||||
|
||||
COPY --from=build /app/dist/remote/ /usr/share/nginx/html/
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Reference in New Issue
Block a user