🏡 index : ~doyle/rgit.git

author holly sparkles <sparkles@holly.sh> 2023-10-06 13:36:42.0 +00:00:00
committer Jordan Doyle <jordan@doyle.la> 2023-10-06 14:21:48.0 +00:00:00
commit
95b3eb22cd051bab2591d73ed5b1136fdacf07cf [patch]
tree
bf0c3001b8b834054d00f751eb33e8b596d1fc4f
parent
dc7abc94c4a2358dad2e36064e19b6d19c4b6a15
download
95b3eb22cd051bab2591d73ed5b1136fdacf07cf.tar.gz

Update Docker to accept REFRESH_INTERVAL as an environment variable

Signed-off-by: Jordan Doyle <jordan@doyle.la>

Diff

 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
+++ 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 <DB_STORE> <BIND_ADDRESS> <SCAN_PATH>
@@ -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 <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