FROM node:latest AS build RUN apt-get update && apt-get install -y --no-install-recommends dumb-init WORKDIR /usr/src/app COPY package*.json .prettierrc .eslintrc.cjs tsconfig.json /usr/src/app/ COPY src /usr/src/app/src/ RUN npm ci RUN npm run lint RUN npm run build RUN npm ci --production FROM node:16.17.0-bullseye-slim ENV NODE_ENV production COPY --from=build /usr/bin/dumb-init /usr/bin/dumb-init USER node WORKDIR /usr/src/app COPY --chown=node:node --from=build /usr/src/app/node_modules /usr/src/app/node_modules COPY --chown=node:node --from=build /usr/src/app/dist /usr/src/app/dist CMD ["dumb-init", "node", "/usr/src/app/dist/index.js"]