I'm doing a web project using docker. After installation of new node packages, I run the docker-compose build command and then the docker-compose up. Then it says there is no any package like that(newly installed one). But when I prune docker images and freshly started using docker-compose up things work perfectly.
What can be the potential issue?
I'm on an ubuntu machine and I use docker with root privileges.
version: "3.8"
services:
api:
build:
dockerfile: DockerFile
context: ./api
target: development
volumes:
- ./api:/nadeera/src/app
- /nadeera/src/app/node_modules/
command: npm run start:dev
depends_on:
- postgres
environment:
DATABASE_URL: postgres://user:password@postgres:5432/db
NODE_ENV: development
JWT_SECRET: hard_to_guess_secret_123
PORT: 3000
ports:
- 3000:3000
- 9229:9229
frontend:
build:
dockerfile: DockerFile
context: ./frontend
target: development
command: npm run start
volumes:
- ./frontend:/nadeera/frontend/src/app
- /nadeera/frontend/src/app/node_modules
ports:
- 4200:4200
links:
- api
postgres:
image: postgres:10.4
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: db
ports:
- 35000:5432
postgres_admin:
image: dpage/pgadmin4:4.28
depends_on:
- postgres
environment:
PGADMIN_DEFAULT_EMAIL: admin@admin.com
PGADMIN_DEFAULT_PASSWORD: password
ports:
- 5050:80
frontend DockerFile
FROM node:14 AS development
WORKDIR /nadeera/frontend/src/app
COPY package*.json ./
RUN npm install
RUN npm install -g @angular/cli@12.0.0
COPY . .
RUN npm run build
EXPOSE 4200
api DockerFile
FROM node:14 AS development
WORKDIR /nadeera/src/app
COPY package*.json ./
RUN npm install
# COPY . .
RUN npm run build
EXPOSE 3000
###################
### Production ###
###################
FROM node:14 AS production
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
WORKDIR /nadeera/src/app
COPY --from=development /nadeera/src/app/ .
EXPOSE 3000
CMD ["node","dist/main"]