I am new to Docker. I have a project set up something like this:
app/
dist/
node_modules/
package.json
Dockerfile
docker-compose.yml
.dockerignore
Dockerfile
FROM node:10.16.2
WORKDIR /app
RUN sed -i '/jessie-updates/d' /etc/apt/sources.list
RUN apt-get update
RUN rm -rf /var/lib/apt/lists/*
RUN npm install --quiet
RUN npm install -g gulp
EXPOSE 3000
docker-compose.yml
version: '2'
services:
web:
build: .
command: gulp
ports:
- "3000:3000"
volumes:
- .:/app
package:
build: .
command: ./package.sh
volumes:
- ./package:/app/package
.dockerignore
# add git-ignore syntax here of things you don't want copied into docker image
.git
*Dockerfile*
*docker-compose*
package-lock.json
node_modules/
When I run docker-compose build --no-cache web && docker-compose up web
, it is actually not creating it's own node_modules
but using the local system's. I want docker's own node_modules
when I run docker. Please help.
I do understand, I am copying all files from local to docker setup, but I want to exclude node_modules and also make it install its own node_modules.