Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update file-watch.md: add ignore attribute path #21820

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions content/manuals/compose/how-tos/file-watch.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -114,14 +114,19 @@ 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:
```text
myproject/
├── web/
│ ├── App.jsx
│ └── index.js
│ ├── index.js
│ └── node_modules/
├── Dockerfile
├── compose.yaml
└── package.json
Expand Down Expand Up @@ -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.

Expand Down