I have a MEAN stack application running on three Docker containers (MongoDB, Express, Angular). I would like to see immediate changes made to the angular app. I tried to follow this thread but got the following error with the Angular container:
no such file or directory, open '/usr/src/app/package.json'
Here is my docker-compose file:
version: '3' # specify docker-compose version
# Define the services/containers to be run
services:
angular: # name of the first service
build: angular-src # specify the directory of the Dockerfile
command: npm start
ports:
- "4200:4200" # specify port forewarding
- "49153:49153"
volumes:
- ./angular-src:/usr/src/app
express: #name of the second service
build: . # specify the directory of the Dockerfile
ports:
- "3000:3000" #specify ports forewarding
links:
- mongodb # link this service to the database service
mongodb: # name of the third service
image: mongo
command: mongod --smallfiles
ports:
- 27017 # specify port forewarding
mongo_seed:
build: ./mongo_seed
links:
- mongodb
And my docker file for the Angular app:
# Create image based on the official Node 6 image from dockerhub
FROM node:8.9.1
# Create a directory where our app will be placed
RUN mkdir -p /usr/src/app
# Change directory so that our commands run inside this new directory
WORKDIR /usr/src/app
# Copy dependency definitions
COPY package.json /usr/src/app
# Install dependecies
RUN npm install
# Get all the code needed to run the app
COPY . /usr/src/app
# Expose the port the app runs in
EXPOSE 4200 49153
# Serve the app
CMD ["npm", "start"]