# Dockerfile.react — Multi-stage build for Modern.js SSR standalone app. # Coexists with the legacy ASP.NET Dockerfile. FROM node:24-slim AS deps WORKDIR /app RUN corepack enable pnpm COPY package.json pnpm-lock.yaml ./ RUN pnpm install --frozen-lockfile FROM deps AS build WORKDIR /app COPY modern.config.ts module-federation.config.ts tsconfig.json ./ COPY src/ src/ # Modern.js publicDir: fonts, images, leaflet marker icons, favicons. # Copied into dist/standalone/public/ at build time. Without this the # /assets/** URLs resolve to the SPA index HTML (OTS font-parse failures, # broken backgrounds, missing tile icons). COPY config/ config/ # Runtime-tunable env vars. modern.config.ts reads these when Modern.js # boots the SSR server at container start, so values set via k8s env # propagate without a rebuild. The ARG line lets CI also bake a value # into the image if the cluster can't set env at runtime. ARG MAP_TILE_URL ENV MAP_TILE_URL=${MAP_TILE_URL} RUN pnpm build:standalone FROM node:24-slim AS runtime WORKDIR /app ENV NODE_ENV=production ENV HOST=0.0.0.0 ENV PORT=8080 RUN corepack enable pnpm COPY --from=build /app/node_modules ./node_modules COPY --from=build /app/dist/standalone/ ./dist/standalone/ COPY --from=build /app/src/ ./src/ COPY package.json modern.config.ts module-federation.config.ts ./ EXPOSE 8080 CMD ["pnpm", "exec", "modern", "serve"]