outofcoffee / imposter

Scriptable, multipurpose mock server. Run standalone mock servers, or embed mocks within your tests.

Home Page:https://imposter.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Autoreload when using docker and config files change

rnestler opened this issue · 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?

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

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