FROM node:20.11.0 as build

WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build:dev

FROM nginx:alpine
COPY nginx_dev.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/build /usr/share/nginx/admintool

# port 8080
EXPOSE 8080

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