# stage 1: build node frontend
FROM node:21 as node-builder

WORKDIR /node-builder

COPY ./package.json .
COPY ./package-lock.json .
COPY ./public ./public
COPY ./src ./src

RUN \
    npm install && \
    npm run build


# stage 2: build final image
FROM nginx:1.25-alpine

COPY --from=node-builder /node-builder/build/. /usr/share/nginx/html
