'Dockerfile wrong directory. I don't know why

Hello I am trying to run my react app on docker and I've encountered a problem! I am beginner at this topic so please help!

FROM node:16.13-slim
WORKDIR /app
RUN chown -R node:node /app
USER node
COPY --chown=node:node package.json yarn.lock /app/
RUN yarn install --frozen-lockfile
COPY --chown=node:node src /app
RUN yarn build
EXPOSE 3000
ENTRYPOINT [ "yarn", "start" ]

enter image description here

my file structure is something like this

enter image description here



Solution 1:[1]

COPY --chown=node:node public src /app

Add the command above, since the public directory is not under the src directory

By adding only the following command

COPY --chown=node:node src /app

You did not copy the public directory

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1