What I am doing wrong?
I have a dockerfile like this
FROM node:alpine
RUN mkdir -p /usr/src/node-app && chown -R node:node /usr/src/node-app
WORKDIR /usr/src/node-app
COPY package.json yarn.lock ./
USER node
RUN yarn install --pure-lockfile
COPY --chown=node:node . .
EXPOSE 3000
When I build the image manually dependencies are installed, I can run a container with it and node_modules folder is present. When I use docker-compose dependencies are not installed and I have to install them with a script after.
My docker-compose.yml
version: '3'
services:
node-app:
build: .
image: node-app
environment:
- MONGODB_URL=mongodb://mongodb:27017/node-boilerplate
ports:
- '3000:3000'
depends_on:
- mongodb
volumes:
- .:/usr/src/node-app
networks:
- node-network
mongodb:
image: mongo:4.2.1-bionic
ports:
- '27017:27017'
volumes:
- dbdata:/data/db
networks:
- node-network
volumes:
dbdata:
networks:
node-network:
driver: bridge
What am I doing wrong? Any tips about docker are appreciated, I am a total noob.