FROM node:14-bullseye AS build

WORKDIR /app

COPY package.json package-lock.json .npmrc ./
RUN npm install -g npm@8.19.4
RUN npm ci --unsafe-perm --before=2025-09-01 --ignore-scripts

COPY . ./

RUN npm run postinstall

RUN npm run build

FROM nginx:1.25-alpine

COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/build /usr/share/nginx/html

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
