FROM gitea.pena/penadevops/container-images/node:main as build

WORKDIR /usr/app
COPY . .

RUN npm install --force && yarn cache clean
RUN npm run build
RUN npm run build:widget

FROM gitea.pena/penadevops/container-images/nginx:main as result
WORKDIR /usr/share/nginx/html
COPY --from=build /usr/app/dist/ /usr/share/nginx/html
COPY --from=build /usr/app/widget/widget.js /usr/share/nginx/html/export/pub.js
COPY ./widget_en.js /usr/share/nginx/html/export/pub_en.js
COPY hub.conf /etc/nginx/conf.d/default.conf
