Skip to content

Commit

Permalink
Add full example project and update README
Browse files Browse the repository at this point in the history
  • Loading branch information
connorhsm committed Apr 12, 2023
1 parent 85be394 commit f53a0e6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 48 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
test.log
Dockerfile.example-service
docker-compose.yml
example/irestarter-test
47 changes: 2 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -66,48 +68,3 @@ services:
labels:
- "docker-irestarter"
```
<!--
### Publishing

Notes for building and publishing
```bash
# For publish:
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag zetifi/docker-irestarter:latest .
# For dev:
docker build --tag zetifi/docker-irestarter:latest .
```

### Full working example

Dockerfile.example-service
```yml
FROM alpine:latest
RUN touch example.log
CMD ["tail", "-f", "example.log"]
```

docker-compose.yml
```yml
version: "3"
services:
docker-irestarter:
build:
context: .
restart: always
volumes:
- ${MONITOR_FILE}:${MONITOR_FILE}
- /var/run/docker.sock:/var/run/docker.sock
environment:
- MONITOR_FILE=${MONITOR_FILE}
example-service:
build:
context: .
dockerfile: Dockerfile.example-service
labels:
- "docker-irestarter"
```
-->
5 changes: 5 additions & 0 deletions example/Dockerfile.example-service
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM alpine:latest

RUN touch example.log

CMD ["tail", "-f", "example.log"]
18 changes: 18 additions & 0 deletions example/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f53a0e6

Please sign in to comment.