Skip to content

Watch: Support Path Pattern Matching #12544

Description

@davidgfitzgerald

Request

It would be nice if the watchpath attribute behaved like the ignore attribute. For example, path could accept wildcards such as *.

At the very least it would help to have some more detail in the API documentation adding that (at least for the time being) pattern matching does not work on path.

Reference: https://docs.docker.com/reference/compose-file/develop/

Example

I would like the convenience of being able to do this:

services:
frontend:
build:
context: ./frontenddockerfile: Dockerfileports:
- "5173:5173"develop:
watch:
- action: rebuildpath: frontend/*.json
- action: rebuildpath: frontend/*.js

instead of the verbose (yet explicit):

services:
frontend:
build:
context: ./frontenddockerfile: Dockerfileports:
- "5173:5173"develop:
watch:
- action: rebuildpath: frontend/jsconfig.json
- action: rebuildpath: frontend/package-lock.json
- action: rebuildpath: frontend/package.json
- action: rebuildpath: frontend/eslint.config.js
- action: rebuildpath: frontend/svelte.config.js
- action: rebuildpath: frontend/tailwind.config.js
- action: rebuildpath: frontend/vite.config.js

Nice To Have

Bonus points for allowing multiple path entries in a single rebuild action:

services:
frontend:
build:
context: ./frontenddockerfile: Dockerfileports:
- "5173:5173"develop:
watch:
- action: rebuildpath: frontend/*.json frontend/*.js

Currently, passing a space separated list is silently interpreted as a single path. So, the below example (misleadingly) does not match frontend/package.json nor frontend/vite.config.js

 - action: rebuildpath: frontend/package.json frontend/vite.config.js

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions