From 95b3eb22cd051bab2591d73ed5b1136fdacf07cf Mon Sep 17 00:00:00 2001 From: holly sparkles Date: Fri, 06 Oct 2023 15:36:42 +0200 Subject: [PATCH] Update Docker to accept REFRESH_INTERVAL as an environment variable Signed-off-by: Jordan Doyle --- Dockerfile | 5 ++++- README.md | 15 +++++++++++++++ docker-compose.override.yml.example | 2 ++ scripts/docker/entrypoint.sh | 8 ++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b1801aa..2043b19 100644 --- a/Dockerfile +++ a/Dockerfile @@ -9,5 +9,8 @@ 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 +++ a/README.md @@ -33,7 +33,7 @@ Usage: ``` -rgit 0.1.0 +rgit 0.1.1 USAGE: rgit --db-store @@ -51,7 +51,11 @@ 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 @@ -132,6 +136,15 @@ An example override file has been has been provided with the repository. To use it, remove the `.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. diff --git a/docker-compose.override.yml.example b/docker-compose.override.yml.example index 8b3c820..b5513c4 100644 --- a/docker-compose.override.yml.example +++ a/docker-compose.override.yml.example @@ -1,4 +1,6 @@ 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 100755 --- /dev/null +++ a/scripts/docker/entrypoint.sh @@ -1,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 -- rgit 0.1.3