Yeah it's confuse a lot, when i start my application with npm start like normally do, it starts fine and i can see my chances and updates but when i create a docker-compose file and a dockerfile and runs into a docker container, it runs a very outdated version of my code.
I tried everything to fix this issue, i can't understand where does docker gets this outdated code that doesn't even exist in my machine or in the project. i cleaned cache also, i removed all images / containers but still the same thing
the question is, where docker finds this code and why does it finds and why does docker run this code that doesn't even exist in my local machine or my code? why can't he run my code like npm start do?
i can't find the issue with it
Here the docker file and docker compose file for a simple local run
FROM node:12.18.4 as build
WORKDIR /app
COPY package.json /app/package.json
COPY package-lock.json /app/package-lock.json
RUN npm ci
RUN npm i react-toastify
COPY . /app
RUN rm .env
COPY .env.production .env
RUN npm run build
# production environment
FROM nginx:1.17.9-alpine
COPY --from=build /app/build /usr/share/nginx/html
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx/nginx.conf /etc/nginx/conf.d
COPY nginx/decode.crt /etc/nginx/decode.crt
COPY nginx/decodewp.key /etc/nginx/decodewp.key
EXPOSE 80
EXPOSE 443
CMD ["nginx", "-g", "daemon off;"]
--------------------------------------------------
version: "3.6"
services:
decode.up4biz.frontend:
build:
context: .
dockerfile: Dockerfile
ports:
- "4000:80"
- "4001:443"
restart: always
stdin_open: true
volumes:
- './:/app'
- '/app/node_modules'
environment:
- CHOKIDAR_USEPOLLING=true