update compose file-watch page to reflect passage to GA. (#18255)

* update compose file-watch page to reflect passage to GA.

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>

* Update content/compose/file-watch.md

---------

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
Co-authored-by: Usha Mandya <47779042+usha-mandya@users.noreply.github.com>
This commit is contained in:
Guillaume Lours 2023-09-22 16:11:09 +02:00 committed by GitHub
parent e1b11f0bae
commit da30c8fc73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 10 deletions

View File

@ -4,10 +4,9 @@ keywords: compose, file watch, experimental
title: Automatically update services with file watch in Docker Compose title: Automatically update services with file watch in Docker Compose
--- ---
> **Experimental** > **Note**
> >
> The Compose file watch feature is currently [Experimental](../release-lifecycle.md). > The Compose file watch feature is available in Docker Compose version 2.22 and later.
{ .experimental }
Use `watch` to automatically update your running Compose services as you edit and save your code. Use `watch` to automatically update your running Compose services as you edit and save your code.
@ -99,7 +98,7 @@ services:
web: web:
build: . build: .
command: npm start command: npm start
x-develop: develop:
watch: watch:
- action: sync - action: sync
path: ./web path: ./web
@ -110,10 +109,10 @@ services:
path: package.json path: package.json
``` ```
In this example, when running `docker compose up --build --wait`, a container for the `web` service is launched using an image built from the `Dockerfile` in the project root. In this example, when running `docker compose watch`, a container for the `web` service is launched using an image built from the `Dockerfile` in the project root.
The `web` service runs `npm start` for its command, which then launches a development version of the application with Hot Module Reload enabled in the bundler (Webpack, Vite, Turbopack, etc). The `web` service runs `npm start` for its command, which then launches a development version of the application with Hot Module Reload enabled in the bundler (Webpack, Vite, Turbopack, etc).
After the service is up, running `docker compose alpha watch` starts watch mode. After the service is up, the watch mode starts monitoring the target directories and files.
Then, whenever a source file in the `web/` directory is changed, Compose syncs the file to the corresponding location under `/src/web` inside the container. Then, whenever a source file in the `web/` directory is changed, Compose syncs the file to the corresponding location under `/src/web` inside the container.
For example, `./web/App.jsx` is copied to `/src/web/App.jsx`. For example, `./web/App.jsx` is copied to `/src/web/App.jsx`.
@ -127,9 +126,8 @@ This pattern can be followed for many languages and frameworks, such as Python w
## Use `watch` ## Use `watch`
1. Add `watch` sections to one or more services in `compose.yaml`. 1. Add `watch` sections to one or more services in `compose.yaml`.
2. Launch a Compose project with `docker compose up --build --wait`. 2. Run `docker compose alpha watch` to launch a Compose project and start the file watch mode.
3. Run `docker compose alpha watch` to start the file watch mode. 3. Edit service source files using your preferred IDE or editor.
4. Edit service source files using your preferred IDE or editor.
>**Looking for a sample project to test things out?** >**Looking for a sample project to test things out?**
> >

View File

@ -1893,7 +1893,7 @@ Manuals:
- path: /compose/networking/ - path: /compose/networking/
title: Networking in Compose title: Networking in Compose
- path: /compose/file-watch/ - path: /compose/file-watch/
title: Use file watch (Experimental) title: Use file watch
- path: /compose/production/ - path: /compose/production/
title: Using Compose in production title: Using Compose in production
- path: /compose/use-secrets/ - path: /compose/use-secrets/