diff --git a/.gitignore b/.gitignore index 2c2e052..31048b1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1 @@ -test.log -Dockerfile.example-service -docker-compose.yml \ No newline at end of file +example/irestarter-test \ No newline at end of file diff --git a/README.md b/README.md index c58eea4..5d66ceb 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ This project combines `inotifywait` from `inotify-tools` with Docker to watch fo For example, this image could be used in a docker-compose file to restart a container upon an update to an SSL certificate file, where the service is unable to handle this itself. In this case, you would configure the environment variable to monitor the certificate file. ## Example compose file +Read on, or [view an example project](example). + This example has been created based upon the docker compose CLI v2. Set the file to monitor for changes as an environment variable. @@ -66,48 +68,3 @@ services: labels: - "docker-irestarter" ``` - diff --git a/example/Dockerfile.example-service b/example/Dockerfile.example-service new file mode 100644 index 0000000..7e1edd6 --- /dev/null +++ b/example/Dockerfile.example-service @@ -0,0 +1,5 @@ +FROM alpine:latest + +RUN touch example.log + +CMD ["tail", "-f", "example.log"] \ No newline at end of file diff --git a/example/docker-compose.yml b/example/docker-compose.yml new file mode 100644 index 0000000..4253f7f --- /dev/null +++ b/example/docker-compose.yml @@ -0,0 +1,18 @@ +version: "3" +services: + docker-irestarter: + image: zetifi/docker-irestarter:latest + restart: always + volumes: + - ./irestarter-test/live:/etc/letsencrypt:ro # Local file or directory to monitor for changes + - /var/run/docker.sock:/var/run/docker.sock + environment: + - MONITOR_FILE=/etc/letsencrypt + - SIGNAL=SIGHUP # Optional signal to pass to main container process, rather than restarting the container + + example-service: + build: + context: . + dockerfile: Dockerfile.example-service + labels: + - "docker-irestarter" # Required label for irestarter to target this container \ No newline at end of file