content: # SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
  #
  # SPDX-License-Identifier: MPL-2.0
  
  ### Build Step
  # pull the Node.js Docker image
  FROM node:20-bullseye as builder
  RUN corepack enable pnpm
  WORKDIR /usr/src/app
  
  
  # copy the package.json files from local machine to the workdir in container
  COPY package*.json ./
  COPY pnpm-lock.yaml ./
  
  # run npm install in our local machine
  RUN pnpm i
  
  # copy the generated modules and all other files to the container
  COPY . .
  
  # build the application
  RUN pnpm run build
  
  ### Serve Step
  # pull the Node.js Docker image
  FROM node:19-bullseye-slim
  
  # change working directory
  WORKDIR /app
  RUN corepack enable pnpm
  COPY --from=builder /usr/src/app/package.json .
  COPY --from=builder /usr/src/app/pnpm-lock.yaml .
  RUN pnpm i
  # copy files from previous step
  COPY --from=builder /usr/src/app/build .
  COPY --from=builder /usr/src/app/node_modules ./node_modules
  
  # our app is running on port 3000 within the container, so need to expose it
  EXPOSE 3000
  
  # the command that starts our app
  CMD ["pnpm", "run", "run:prod"]
  