简体   繁体   中英

keystonejs docker-compose restarting a server when file changes

I am using Keystonejs and docker-compose when I push a new file changes to my webapp. How to apply the changes?

docker-compose up

will restart the server without applying the changes.

What I do is remove my web app image and fire docker-compose up again. But this will do npm install again. Which takes a long time. Is there a way to apply small change like html change without firing npm install from within Dockerfile?

It would help if you share your docker-compose.yml file

Try the steps in this order:

  1. If the code is on local host, are you using volume to share it with docker container? If no, please try that first. See https://docs.docker.com/compose/compose-file/#volumes

  2. If sharing folder (volume) doesn't work, try tools like https://github.com/remy/nodemon -- according to their website "nodemon is a tool that helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected."

Old question and no docker-compose.yml provided by the original question, but almost 99% sure that the problem is solved using the build flag on docker-compose

docker-compose up --build

this will force to rebuild the image and fix the original statement :

"What I do is remove my web app image and fire docker-compose up again"

with some luck depending on your Dockerfile and docker-compose.yml it will cache npm install and also fix

But this will do npm install again. Which takes a long time.

I hope this helps anyone facing the same issue

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM