From fc9833d7cbb68565befcd0e83912c1bc88802653 Mon Sep 17 00:00:00 2001 From: Plain <56195905+hanjie-chen@users.noreply.github.com> Date: Wed, 15 Jan 2025 07:17:31 +0000 Subject: [PATCH 1/2] Update file-watch.md add ignore path which is the relative to the path defined in teh same watch --- content/manuals/compose/how-tos/file-watch.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/content/manuals/compose/how-tos/file-watch.md b/content/manuals/compose/how-tos/file-watch.md index 365c0d60aded..471de1b187fb 100644 --- a/content/manuals/compose/how-tos/file-watch.md +++ b/content/manuals/compose/how-tos/file-watch.md @@ -12,7 +12,7 @@ aliases: {{< include "compose/watch.md" >}} `watch` adheres to the following file path rules: -* All paths are relative to the project directory +* All paths are relative to the project directory, apart from ignore path * Directories are watched recursively * Glob patterns aren't supported * Rules from `.dockerignore` apply @@ -114,6 +114,10 @@ For `path: ./app/html` and a change to `./app/html/index.html`: * `target: /app/static` -> `/app/static/index.html` * `target: /assets` -> `/assets/index.html` +### `ignore` + +The `ignore` paths are relative to the `path` defined in the same `watch` rule, not to the project directory. In the following Example 1, the ignore path would be relative to the `./web` directory specified in the `path` attribute. + ## Example 1 This minimal example targets a Node.js application with the following structure: @@ -121,7 +125,8 @@ This minimal example targets a Node.js application with the following structure: myproject/ ├── web/ │ ├── App.jsx -│ └── index.js +│ ├── index.js +│ └── node_modules/ ├── Dockerfile ├── compose.yaml └── package.json @@ -152,6 +157,8 @@ For example, `./web/App.jsx` is copied to `/src/web/App.jsx`. Once copied, the bundler updates the running application without a restart. +And in this case, the `ignore` rule would apply to `myproject/web/node_modules/`, not `myproject/node_modules/`. + Unlike source code files, adding a new dependency can’t be done on-the-fly, so whenever `package.json` is changed, Compose rebuilds the image and recreates the `web` service container. From ae8662687a970b8c8147734c2fffae97b8d0986d Mon Sep 17 00:00:00 2001 From: Allie Sadler <102604716+aevesdocker@users.noreply.github.com> Date: Mon, 3 Feb 2025 08:43:22 +0000 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Guillaume Lours <705411+glours@users.noreply.github.com> --- content/manuals/compose/how-tos/file-watch.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/manuals/compose/how-tos/file-watch.md b/content/manuals/compose/how-tos/file-watch.md index 471de1b187fb..4d7721710f2c 100644 --- a/content/manuals/compose/how-tos/file-watch.md +++ b/content/manuals/compose/how-tos/file-watch.md @@ -12,7 +12,7 @@ aliases: {{< include "compose/watch.md" >}} `watch` adheres to the following file path rules: -* All paths are relative to the project directory, apart from ignore path +* All paths are relative to the project directory, apart from ignore file patterns * Directories are watched recursively * Glob patterns aren't supported * Rules from `.dockerignore` apply @@ -116,7 +116,7 @@ For `path: ./app/html` and a change to `./app/html/index.html`: ### `ignore` -The `ignore` paths are relative to the `path` defined in the same `watch` rule, not to the project directory. In the following Example 1, the ignore path would be relative to the `./web` directory specified in the `path` attribute. +The `ignore` patterns are relative to the `path` defined in the current `watch` action, not to the project directory. In the following Example 1, the ignore path would be relative to the `./web` directory specified in the `path` attribute. ## Example 1