FROM node:16.14.2-alpine as builder

WORKDIR /offshift

COPY . /offshift/

RUN npm install --force

RUN npm run build:prod

FROM nginx:1.21.6-alpine

COPY nginx.conf /etc/nginx/conf.d/default.conf

RUN rm -rf /usr/share/nginx/html/*

COPY --from=builder /offshift/dist /usr/share/nginx/html

EXPOSE 8080

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