diff --git a/Dockerfile b/Dockerfile index b1801aa..2043b19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,5 +9,8 @@ RUN cargo build --release FROM debian:bullseye-slim COPY --from=builder /sources/target/release/rgit /rgit +COPY ./scripts/docker/entrypoint.sh . +RUN chmod +x entrypoint.sh + EXPOSE 8000 -ENTRYPOINT ["/rgit", "[::]:8000", "/git", "-d", "/tmp/rgit-cache.db"] +ENTRYPOINT ["/entrypoint.sh"] diff --git a/README.md b/README.md index d3b9c29..f6dd263 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ $ Usage: ``` -rgit 0.1.0 +rgit 0.1.1 USAGE: rgit --db-store @@ -51,6 +51,10 @@ OPTIONS: doesn't already exist The Sled database is very quick to generate, so this can be pointed to temporary storage + --refresh-interval + Configures the metadata refresh interval (eg. "never" or "60s") + + [default: 5m] -h, --help Print help information @@ -133,6 +137,15 @@ An example override file has been has been provided with the repository. To use `.example` extension from `docker-compose.override.yml.example`, and adjust the UID and GID to match the user that owns the directory containing your repositories. +To configure automatic refresh in Docker, an environment variable is also provided. + +``` +services: + rgit: + environment: + - REFRESH_INTERVAL=5m +``` + Afterwards, bring up the container with `docker-compose up` to make sure everything works. ### Notes diff --git a/docker-compose.override.yml.example b/docker-compose.override.yml.example index 8b3c820..b5513c4 100644 --- a/docker-compose.override.yml.example +++ b/docker-compose.override.yml.example @@ -2,3 +2,5 @@ version: '3' services: rgit: user: 1000:1000 + environment: + - REFRESH_INTERVAL=5m diff --git a/scripts/docker/entrypoint.sh b/scripts/docker/entrypoint.sh new file mode 100755 index 0000000..dc4eac4 --- /dev/null +++ b/scripts/docker/entrypoint.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +if [ -z ${REFRESH_INTERVAL+x} ]; +then + ./rgit [::]:8000 /git -d /tmp/rgit-cache.db; +else + ./rgit [::]:8000 /git -d /tmp/rgit-cache.db --refresh-interval $REFRESH_INTERVAL; +fi