FROM node:20-alpine as nodebuild

WORKDIR /ui

COPY frontend/fic/ .

RUN npm install --network-timeout=100000 && \
    sed -i 's!@popperjs/core/dist/esm/popper!@popperjs/core!' node_modules/sveltestrap/src/*.js node_modules/sveltestrap/src/*.svelte && \
    npm run build


FROM scratch

COPY --from=nodebuild /ui/build/ /www/htdocs-frontend
