Answer the question
In order to leave comments, you need to log in
How to make friends between Docker and node_modules?
Here is such a Dockerfile:
FROM node:16.2-alpine3.12
ENV CONTAINER_PATH /usr/src/front
WORKDIR $CONTAINER_PATH
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8080
CMD ["npm", "run", "serve"]
Answer the question
In order to leave comments, you need to log in
Seems to have fixed (docker compose file example):
front:
container_name: front
image: front
restart: unless-stopped
build:
context: ./front
dockerfile: Dockerfile
volumes:
- "./front:/usr/src/front"
- /usr/src/front/node_modules <----- надо было добавить это
ports:
- 4444:8080
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question