Using <service>.develop.watch without a <service>.build section does not initialise watches
sdolemelipone opened this issue · comments
What is the problem you're trying to solve
If a watch is defined for a service but the service does not have a build
section, the watch is ignored/not initialised.
However, watches with action sync
or sync+restart
do not need to rebuild the service image, so do not necessarily require a build
section.
E.g. running docker compose up --watch
with the below configuration does not cause a watch to be set up.
my-service:
image: myimage
develop:
watch:
- path: ./app
action: sync+restart
target: /home/web/app
If a build
section is defined for the service, then the watch is initialised correctly:
my-service:
image: myimage
build: app
develop:
watch:
- path: ./app
action: sync+restart
target: /home/web/app
Describe the solution you'd like
Either:
- update of the documentation to reflect this
or ideally:
- allow
sync
andsync+restart
watches to run without abuild
section being defined.
Additional context
I expect there are many use cases where a watch would be required without a build step. One such example is a main service with a complicated build step, then a number of secondary services which use the same image (but do not re-define the build steps from the main service).
Thanks.