imposter icon indicating copy to clipboard operation
imposter copied to clipboard

Autoreload when using docker and config files change

Open rnestler opened this issue 1 year ago • 2 comments

I mount the configuration via volume into the imposter docker container using the following docker-compose.yml:

services:
  imposter:
    image: outofcoffee/imposter-all:3.36.2
    container_name: imposter
    volumes:
      - ./imposter_config:/opt/imposter/config
    ports:
      - 127.0.0.1:8080:8080

Now every time I make changes to the configuration I need to restart the docker container. While I can automate this with fswatch --event Updated --event Removed --event Created -or imposter_config/ | xargs -I{} docker compose restart it takes quite some time until the docker container is restarted and ready again.

Is there some easy way to enable auto reloading whenever the configuration changed?

rnestler avatar Apr 16 '24 14:04 rnestler

I could solve it myself by overriding the entrypoint with entrypoint: ["imposter", "up", "--auto-restart", "/opt/imposter/config"]

rnestler avatar Apr 16 '24 15:04 rnestler

Hi @rnestler, your solution is a good one. Using the CLI avoids the container itself restarting, just the JVM process inside 👍

outofcoffee avatar Apr 26 '24 19:04 outofcoffee