Skip to content

Commit

Permalink
Update Docker to accept REFRESH_INTERVAL as an environment variable
Browse files Browse the repository at this point in the history
Signed-off-by: Jordan Doyle <[email protected]>
  • Loading branch information
holly sparkles authored and w4 committed Oct 6, 2023
1 parent dc7abc9 commit 95b3eb2
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $
Usage:

```
rgit 0.1.0
rgit 0.1.1
USAGE:
rgit --db-store <DB_STORE> <BIND_ADDRESS> <SCAN_PATH>
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.override.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ version: '3'
services:
rgit:
user: 1000:1000
environment:
- REFRESH_INTERVAL=5m
8 changes: 8 additions & 0 deletions scripts/docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 95b3eb2

Please sign in to comment.