diff --git a/Dockerfile.react b/Dockerfile.react index c9c977e5..b197dd49 100644 --- a/Dockerfile.react +++ b/Dockerfile.react @@ -1,7 +1,6 @@ -# Dockerfile.react — Multi-stage build for standalone SSR server -# Coexists with the legacy ASP.NET Dockerfile +# Dockerfile.react — Multi-stage build for Modern.js SSR standalone app. +# Coexists with the legacy ASP.NET Dockerfile. -# Stage 1: Install dependencies FROM node:24-slim AS deps WORKDIR /app @@ -10,23 +9,33 @@ 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/ +# 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/ RUN pnpm build:standalone -# Stage 3: Minimal production image 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 -ENTRYPOINT ["node", "dist/standalone/index.js"] +CMD ["pnpm", "exec", "modern", "serve"] diff --git a/scripts/sync-to-flights-front.sh b/scripts/sync-to-flights-front.sh index cbdd91cc..9781486f 100755 --- a/scripts/sync-to-flights-front.sh +++ b/scripts/sync-to-flights-front.sh @@ -35,6 +35,10 @@ echo "2/5 Copying source files..." cp -r "$SRC_DIR/src" "$TARGET_DIR/src" cp -r "$SRC_DIR/tests" "$TARGET_DIR/tests" cp -r "$SRC_DIR/scripts" "$TARGET_DIR/scripts" +# Modern.js publicDir — fonts, images, leaflet icons, favicons. Copied to +# dist/standalone/public/ at build time. Without these the app serves the +# SPA index for /assets/** and breaks @font-face, img references, tile icons. +cp -r "$SRC_DIR/config" "$TARGET_DIR/config" cp "$SRC_DIR/package.json" "$TARGET_DIR/package.json" cp "$SRC_DIR/pnpm-lock.yaml" "$TARGET_DIR/pnpm-lock.yaml" cp "$SRC_DIR/tsconfig.json" "$TARGET_DIR/tsconfig.json" @@ -45,6 +49,7 @@ cp "$SRC_DIR/playwright.config.ts" "$TARGET_DIR/playwright.config.ts" cp "$SRC_DIR/eslint.config.js" "$TARGET_DIR/eslint.config.js" cp "$SRC_DIR/Makefile" "$TARGET_DIR/Makefile" cp "$SRC_DIR/CLAUDE.md" "$TARGET_DIR/CLAUDE.md" +cp "$SRC_DIR/AGENTS.md" "$TARGET_DIR/AGENTS.md" # Dockerfile — use the SSR-specific one cp "$SRC_DIR/Dockerfile.react" "$TARGET_DIR/Dockerfile"