FROM node:20.15.1-alpine AS builder

WORKDIR /app/builder

COPY . .

RUN npm install \
  && npm run build

FROM nginx:1.19.2

WORKDIR /usr/share/nginx/html
COPY --from=builder /app/builder/dist/dashboard/browser ./
COPY --from=builder /app/builder/nginx.conf /etc/nginx/nginx.conf
COPY --from=builder /app/builder/docker-entrypoint.sh /docker-entrypoint.sh

ENTRYPOINT ["/docker-entrypoint.sh"]

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