# b2g_filems_fe/Dockerfile
FROM public.ecr.aws/docker/library/node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm i --legacy-peer-deps
COPY . .
# Build AND concatenate. b2g_filems_fe is the micro-frontend (package name "micro-fe"):
# concat.js merges runtime/polyfills/main into app/micro-fe.js, which b2g and gMarket
# inject via window.__env.microfeHost. A plain `ng build` emits hashed main.<hash>.js and
# no micro-fe.js, which is why those apps had to load it from the production site.
# --output-hashing=none is required: concat.js reads the unhashed filenames.
RUN npm run bundle-docker

FROM public.ecr.aws/docker/library/nginx:alpine
# Angular 16 legacy "browser" builder with outputPath "app" (see angular.json),
# so output is /app/app - there is no dist/<project>/browser layout here.
COPY --from=build /app/app /usr/share/nginx/html
COPY docker/nginx-spa.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
