One of my projects features a Dockerized API. The dev process was: write a file, rebuild container, and restart container. There’s a better way!
Add this to your docker-compose.yml
(path
and target
directories will be unique to your project):
develop:
watch:
- path: ./
target: /app/
action: sync+restart
Then, start your container with --watch
.
docker-compose up --watch api
Now, anytime I write a file, Docker quickly copies it into my target directory and restarts the container. This reduced iterations from over a minute to under ten seconds.