FROM rockylinux/rockylinux:10 AS build

RUN dnf install -y nodejs npm && dnf clean all

WORKDIR /app

COPY package.json package-lock.json ./
RUN npm ci --no-audit

COPY . .
RUN npm run build

FROM rockylinux/rockylinux:10 AS final

RUN dnf install -y nginx && dnf clean all

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

EXPOSE 8080

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