## build stage
FROM node:lts-alpine3.10 as build-stage

RUN apk update
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build

# production stage
FROM --platform=linux/amd64 nginx:stable-alpine as production-stage
WORKDIR /usr/share/nginx/html/3d_viewer
COPY --from=build-stage /app/dist .
COPY docker_conf/nginx/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 8080
CMD ["nginx", "-g", "daemon off;"]