Ultimate Docker Course - Building Image - errors

Intro as to how my problems began…

I encountered my first error in the download of the sample app in video #3. The app wont run, lots of warnings and it won’t start either and I am not a react person so something simple caused me to stop for over 1 hour. Finally got it fixed. Also figure out ho to make a new app from scratch too. The example sample app is old and wont run witn node 18-21xx latest.

Please fix this @Mosh?

The current issue I need help with

video #11 in this section is a disaster for me. I can not figure this out.

when I follow along I am getting errors when the script tries to run npm install permissions are still denied so I commented out that line to the bottom as shown in the video. launched the docker image and accessed the container by landing the the /apps directory if I run ls -lah I can see that the only thing that the app user owns or has created is the app directory… everything that was passed to the build engine was run by root which is not as I understood the video. I understood moving:

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

to the top that contextually everything else in the Dockerfile from there on runs in context to user. if this were the case it would and shoud work as in the video.

Something has changed or something is wrong, or I FOO’ed up something and have no clue. I am not a noob to linux but docker I am a noob

in the container touch test.txt show app app as the owner group
why then does this not work as shown or described in the video?

I got this to work as in the video but NOT by doing what the video show at time stamp 1:20 in video #11

COPY . .
was wrong for me

COPY --chown=app:app . .
this worked for me

if you get stuck like me do this or @Mosh please fix this or make notes at the bottom of the video so folks dont get stuck. This section I have lost almost 2 hours just figuring out solutions. Good experience yes but I am keen to learn the course.