Skip to content

Commit 8b1ee4b

Browse files
committed
til: compose watch
1 parent d116cea commit 8b1ee4b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docker/docker-compose.md

+13
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,16 @@ services:
6767
depends_on:
6868
- database
6969
```
70+
71+
## 2. Use Compose watch
72+
73+
> Compose >= 2.22
74+
75+
- Use `watch` to automatically update and preview your running Compose services as you edit and save your code.
76+
- Use case: automatic updates.
77+
- The `watch` attribute defines a list of rules that control automatic service updates based on local file changes.
78+
- `path` pattern.
79+
- `action` to take when a modification is detected.
80+
- `sync`: compose makes sure any changes made to files on your host automatically match with the corresponding files within the service container -> **hot reload**.
81+
- `rebuild`: compose automatically builds a new image with BuildKit and replaces the running service container -> compiled languages or as fallbacks for modifications to particular files that require a full image rebuild (e.g. `package.json`).
82+
- `sync+restart`: composes synchronizes your changes with the services containers and restarts it.

0 commit comments

Comments
 (0)