# 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/ # Public env values baked into dist/standalone/html/main/index.html by # modern.config.ts at build time. Defaults target the devwebzavod cluster # (no /map/api/** or /api/** ingress rule → hit the upstream that the # real Aeroflot ingress terminates). Production overrides via # --build-arg, e.g. # --build-arg MAP_TILE_URL=/map/api/tile/{z}/{x}/{y}.jpeg # --build-arg API_BASE_URL=/api # Defaults live here rather than in deployment/build-docker.sh because # bash `${VAR:=default}` stops at the first unescaped `}` — the literal # `{z}/{x}/{y}` in the URL was being truncated to `{z`. Dockerfile ARG # defaults are plain strings, no shell parsing. ARG MAP_TILE_URL=https://flights.test.aeroflot.ru/map/api/tile/{z}/{x}/{y}.jpeg ENV MAP_TILE_URL=${MAP_TILE_URL} ARG API_BASE_URL=https://flights.test.aeroflot.ru/api ENV API_BASE_URL=${API_BASE_URL} ARG AEROFLOT_SHELL_LOADER_PROXY=1 ENV AEROFLOT_SHELL_LOADER_PROXY=${AEROFLOT_SHELL_LOADER_PROXY} ARG AEROFLOT_SHELL_REFERRER_ORIGIN=https://flights.test.aeroflot.ru ENV AEROFLOT_SHELL_REFERRER_ORIGIN=${AEROFLOT_SHELL_REFERRER_ORIGIN} 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 ./ COPY scripts/standalone-server.mjs scripts/aeroflot-url-rewrite.mjs ./scripts/ EXPOSE 8080 CMD ["node", "scripts/standalone-server.mjs"]