Local files not mounting in docker container

Good day,
I’m having issue when mounting local files to docker, but when docker restart it reflects.

See more details below:

Docker container file structure:

Dockerfile:

FROM node:latest

WORKDIR /app

COPY . ./

RUN npm cache clean --force
RUN npm install
RUN NODE_ENV=production npm run build

ENV PORT 2000

EXPOSE ${PORT}

ENTRYPOINT ["npm", "run", "dev"]

docker-compose.yml:

version: '3.8'
services:
  reactjs:
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - .:/app
    ports:
      - "2000:2000"
    depends_on:
      - reactmysql
    entrypoint: npm run dev

  reactmysql:
    image: mysql:latest
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: reactdb
      MYSQL_USER: user
      MYSQL_PASSWORD: password
    ports:
      - "3306:3306"

  reactphpmyadmin:
    image: phpmyadmin/phpmyadmin
    ports:
      - '2080:80'
    environment:
      TZ: Asia/Manila
      PMA_HOST: reactmysql
    depends_on:
      - reactmysql

What are you trying to achieve? What is the current status and what did you expect instead?

You build your image with a Dockerfile, everything into /app. Then you run the image but mount your local folder into /app, so the internal files are practically “overwritten” (well, hidden).

I recommend to get a good Docker 101 book, take a little time and learn about the Docker basics first.