Permission issues in my Dockerfile

If I made root the “user” in the react-app the image will build. But when I made “App” the user the build will fail.

See my Dockerfile below:

FROM node:14.21.2-alpine3.17

RUN addgroup app && adduser -S -G app app

USER root

WORKDIR /app

COPY package*.json .

RUN npm install && npm audit fix --force

COPY . .

ENV API_URL=http://api.myapp.com/

EXPOSE 3000

ENTRYPOINT [ “npm”, “start” ]

Anyone with suggestion?

Thank you.

wakandom