summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2022-08-02 17:48:11 -0400
committerMalfurious <m@lfurio.us>2022-08-02 17:48:11 -0400
commit394b99270ab3c9c48eb15b1fc34c8a4a1405616f (patch)
tree57a6b81895500cbad9a31a060c4ca84cc7be2eeb
parente61969f19f7f87cb65f4f58ff0fb37ddcb012053 (diff)
downloadsrcnode-394b99270ab3c9c48eb15b1fc34c8a4a1405616f.tar.gz
srcnode-394b99270ab3c9c48eb15b1fc34c8a4a1405616f.zip
Add Dockerfile for gitolite/ssh service
Signed-off-by: Malfurious <m@lfurio.us>
-rw-r--r--docker/.gitignore1
-rw-r--r--docker/Dockerfile.gitolite25
2 files changed, 26 insertions, 0 deletions
diff --git a/docker/.gitignore b/docker/.gitignore
new file mode 100644
index 0000000..2fa7496
--- /dev/null
+++ b/docker/.gitignore
@@ -0,0 +1 @@
+*.pub
diff --git a/docker/Dockerfile.gitolite b/docker/Dockerfile.gitolite
new file mode 100644
index 0000000..e872678
--- /dev/null
+++ b/docker/Dockerfile.gitolite
@@ -0,0 +1,25 @@
+# https://gitolite.com/gitolite/index.html
+# https://github.com/sitaramc/gitolite
+# https://wiki.archlinux.org/title/Gitolite
+
+FROM archlinux
+
+# Set this to the administrator's SSH public key file (username.pub)
+ARG pubkey
+
+# The gitolite package implies git, openssh, and creates the host user
+RUN pacman-key --init
+RUN pacman -Syu --needed --noconfirm gitolite
+
+# Initialize the gitolite datastore
+COPY $pubkey /
+RUN runuser -u gitolite -- gitolite setup -pk /$pubkey
+# todo symlink files
+VOLUME /var/lib/gitolite
+
+# sshd host keys are stored in a volume so that rebuilding/updating the
+# image doesn't break user trust
+RUN ssh-keygen -A
+VOLUME /etc/ssh
+
+CMD ["/usr/bin/sshd", "-D"]