Nodemon or Dev Dependencies failing in the 2nd stage

my production stage seems fine, when I move onto the dev stage it’s not installing my dev dependencies. Particularly when it gets to the last command I’m getting an error of The command '/bin/sh -c npm install --only=dev --silent && npm cache clean --force' returned a non-zero code: 243

Dockerfile

# docker build -t api:prod --target prod .
FROM node:10.19.0-slim as prod
ENV NODE_ENV=production
EXPOSE 3000
WORKDIR /node
COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
# RUN apk add --no-cache apt-get?
# RUN apk add --no-cache tini
RUN apt-get update && mkdir /this_app && chown -R node:node .
# node comes with a default user
USER node
RUN npm install --production --silent && npm cache clean --force
WORKDIR /node/this_app
COPY . .
# ENTRYPOINT [ "/sbin/tini", "--"]
CMD ["node", "./bin/www"]

# docker build -t api:dev .
FROM prod as dev
ENV NODE_ENV=development
# WORKDIR /node
RUN npm install --only=dev --silent && npm cache clean --force
# WORKDIR /node/this_app
CMD ["nodemon", "./bin/www", "--inspect=0.0.0.0:3000"]

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.