Answer the question
In order to leave comments, you need to log in
How to properly implement hot reload in docker?
I'm using Nodemon for hot reload, how do I properly insert it into docker?
version: "3"
services:
mongo:
hostname: mongo
image: mongo
restart: always
volumes:
- mongodata:/data/db
ports:
- "27017:27017"
logging:
driver: none
api:
build:
context: api/
dockerfile: Dockerfile
environment:
NODE_ENV: 'production'
SECRET: 'supersecretword'
MONGO_HOST: 'mongodb://mongo/app'
PORT: 3000
ports:
- "3000:3000"
links:
- mongo
depends_on:
- mongo
app:
build:
context: app/
dockerfile: Dockerfile
ports:
- "80:80"
volumes:
mongodata:
version: "3"
services:
api:
build:
context: api/
dockerfile: Dockerfile.dev
environment:
NODE_ENV: development
SECRET: 'supersecretword'
MONGO_HOST: 'mongodb://mongo/app'
PORT: 3000
volumes:
- ./api:/usr/src/api
- /api/node_modules
app:
build:
context: app/
dockerfile: Dockerfile.dev
environment:
NODE_ENV: development
volumes:
- ./app:/usr/src/app
- /app/node_modules
FROM node:10
WORKDIR /usr/src/api
COPY ./package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["node", "dist/server.js"]
FROM node:10
WORKDIR /usr/src/api
RUN npm install
EXPOSE 3000
CMD ["npm", "run", "start"]
"scripts": {
"start": "nodemon server.js --exec babel-node --presets env"
}
Answer the question
In order to leave comments, you need to log in
I solved the problem by adding the -L flag for nodemon
https://github.com/remy/nodemon#application-isnt-r...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question