I'm working on a service in a 'system' orchestrated using docker-compose. The service is written in a compiled language and I need to rebuild it when I make a change. I'm trying to find the best way to quickly iterate on changes.
I've tried 2 'workflows', both rely on being linked to the source directory via a volume:
to get the latest source.
- Bring up all the supporting containers with
docker-compose up -d
- Stop the container for the service under development
- Run a new container using the image
docker-compose run --name SERVICE --rm SERVICE /bin/bash
- Within that container run compile and run the application at the exposed port.
- Restart by stopping the running process and then rebuilding.
- (requires Dockerfile
CMD
to build and then run the service) - Stop the service:
docker-compose kill SERVICE
- Restart the service
docker-compose up -d --no-deps SERVICE
The problem is both take too long to restart vs restarting the service locally (running on my laptop independently of docker). This setup seems to be ok with interpreted languages that can hot-reload changed files but I've yet to find a suitably fast system for compiled language services.