Diff
.dockerignore | 1 +
Dockerfile | 15 +++++++++++++++
README.md | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.github/workflows/docker-publish.yml | 45 +++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 124 insertions(+)
@@ -1,0 +1,1 @@
target
@@ -1,0 +1,15 @@
FROM rust:1.71-slim AS builder
RUN apt-get update && apt-get install -y libssl-dev pkg-config
COPY . /sources
WORKDIR /sources
RUN cargo build --release
RUN chown nobody:nogroup /sources/target/release/rgit
FROM debian:bullseye-slim
COPY --from=builder /sources/target/release/rgit /rgit
USER nobody
EXPOSE 8000
ENTRYPOINT ["/rgit", "[::]:8000", "/git", "-d", "/tmp/rgit-cache.db"]
@@ -13,6 +13,11 @@
Includes a dark mode for late night committing.
Your `SCAN_PATH` should contain (optionally nested) [bare repositories][], and a `config` file
can be written with a `[gitweb.owner]` key to signify ownership.
[bare repositories]: https://git-scm.com/book/en/v2/Git-on-the-Server-Getting-Git-on-a-Server
Usage:
```
@@ -40,4 +45,62 @@
-V, --version
Print version information
```
### Installation
#### From Source
rgit can be installed from source by cloning, building using [`cargo`][] and running the binary:
```bash
$ git clone https://github.com/w4/rgit
$ cd rgit
$ cargo build --release
$ ./target/release/rgit [::]:3333 /path/to/my-repos -d /tmp/rgit-cache.db
```
[`cargo`]: https://www.rust-lang.org/
#### NixOS
Running rgit on NixOS is extremely simple, simply import the module into your `flake.nix` and use the
provided service:
```nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
rgit = {
url = "github:w4/rgit";
inputs.nixpkgs = "nixpkgs";
};
};
outputs = { nixpkgs, ... }: {
nixosConfigurations.mySystem = nixpkgs.lib.nixosSystem {
modules = [
rgit.nixosModules.default
{
services.rgit = {
enable = true;
bindAddress = "[::]:3333";
dbStorePath = "/tmp/rgit.db";
repositoryStorePath = "/path/to/my-repos";
};
}
...
];
};
};
}
```
#### Docker
Running rgit in Docker is also simple, just mount the directory containing your repositories to `/git`:
```bash
$ docker run --mount type=bind,source=/path/to/my-repos,target=/git -it ghcr.io/w4/rgit:main
```
@@ -1,0 +1,45 @@
name: Docker
on:
schedule:
- cron: '45 20 * * *'
push:
branches: [ main ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}