The watch attribute automatically updates and previews your running Compose services as you edit and save your code. For many projects, this enables a hands-off development workflow once Compose is running, as services automatically update themselves when you save your work.
How I did it
Add a watch config to each service. It will reload the project when the codebase changes and rebuild the project when the pyproject.toml changes (ie possibly requiring a reinstall of dependencies)
[!NOTE]
Unfortunately, this does not restart services when environment variables are changed in the docker-compose.yml file. I am unsure how to do that with docker compose watch.
How you can test it
ensure your docker compose version is >=2.22.0: docker compose version
start: docker compose up
enter watch mode: press w
save file in a service, note refresh in docker compose logs
What I am changing
In this PR, we enable Docker Compose Watch. From the docs:
How I did it
pyproject.toml
changes (ie possibly requiring a reinstall of dependencies)How you can test it
>=2.22.0
:docker compose version
docker compose up
Related Issues
-