I believe you made a mistake there at line #3 in the Dockerfile. You should copy files in project directory to your workdirectory which is /app. Now you declared COPY . . that is copying files to the same directory.
In the line above that one, I am setting the working directory (inside the container) to /app (WORKDIR /app) and then copying everything from build context root (which is the current folder on my host machine in this case: .) to the target folder inside the container. Since the working directory is set to /app the . in the COPY instruction copies everything to that folder.
If I removed the WORKDIR, I would also need to update the COPY instruction to read COPY . /app
Thanks,
Peter
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi there Peter!
I believe you made a mistake there at line #3 in the Dockerfile. You should copy files in project directory to your workdirectory which is /app. Now you declared
COPY . .
that is copying files to the same directory.Cheers!
Hi Justina!
In the line above that one, I am setting the working directory (inside the container) to /app (
WORKDIR /app
) and then copying everything from build context root (which is the current folder on my host machine in this case:.
) to the target folder inside the container. Since the working directory is set to/app
the.
in the COPY instruction copies everything to that folder.If I removed the WORKDIR, I would also need to update the COPY instruction to read
COPY . /app
Thanks,
Peter