# docker build . -t docker.frappet.com/demo/qualifying-exam-cms:latest
FROM node:20-alpine AS build-stage
WORKDIR /app
# optimize build speed by copy all .xx folder and 
COPY cms/*.json .
COPY cms/*.*s .
RUN npm i
COPY cms/static ./static
COPY cms/src ./src
RUN npm run build

FROM node:lts-alpine AS production-stage
WORKDIR /app
COPY --from=build-stage /app .
EXPOSE 80
ENV PORT=80
CMD ["node", "./build/index.js"]
