summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2023-08-12 21:40:04 -0400
committerMalfurious <m@lfurio.us>2023-08-12 21:40:04 -0400
commit19e7dc8932cf6cc8671b474ae258921480d9c608 (patch)
treeeac2b2d95badb1ae7cfb080864d287fa62ea6605
parent7ac25bc55405b51dd89f38ffa340619f5986090b (diff)
downloadsrcnode-19e7dc8932cf6cc8671b474ae258921480d9c608.tar.gz
srcnode-19e7dc8932cf6cc8671b474ae258921480d9c608.zip
gitolite: Make admin pubkey an optional input to Docker image
Automating the build of this image will be awkward if we need a user-supplied input file each time. At best, it will probably lead to building out of per-instance configuration branches that store the file... The initial administrator pubkey is only really needed to include in the first image that is run at any given site, since a new install doesn't have a config/repository datastore yet. Once that is the case, the procedure in the Dockerfile to init the /var/lib/gitolite directory (now refactored to a shell script file) can be skipped, since that directory will be replaced by the previous container's volume. This is probably not the final form of this kind of build design change, but will work for now to get up and running easily with cychedelic. Signed-off-by: Malfurious <m@lfurio.us>
-rw-r--r--docker/Dockerfile.gitolite12
-rwxr-xr-xdocker/gitolite_init.sh6
2 files changed, 9 insertions, 9 deletions
diff --git a/docker/Dockerfile.gitolite b/docker/Dockerfile.gitolite
index 66367b5..d2ca1ae 100644
--- a/docker/Dockerfile.gitolite
+++ b/docker/Dockerfile.gitolite
@@ -4,20 +4,14 @@
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
-RUN runuser -u gitolite -- chmod 755 /var/lib/gitolite
-RUN runuser -u gitolite -- chmod -R 755 /var/lib/gitolite/repositories
-RUN runuser -u gitolite -- ln -sf .gitolite/conf/.gitolite.rc /var/lib/gitolite
-RUN runuser -u gitolite -- ln -sf .gitolite/conf/.gitconfig /var/lib/gitolite
+COPY . /app
+RUN if [ -f "/app/admin.pub" ]; \
+ then runuser -u gitolite -- /app/gitolite_init.sh "/app/admin.pub"; fi
VOLUME /var/lib/gitolite
# sshd host keys are stored in a volume so that rebuilding/updating the
diff --git a/docker/gitolite_init.sh b/docker/gitolite_init.sh
new file mode 100755
index 0000000..bd70222
--- /dev/null
+++ b/docker/gitolite_init.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+gitolite setup -pk "$1"
+chmod 755 /var/lib/gitolite
+chmod -R 755 /var/lib/gitolite/repositories
+ln -sf .gitolite/conf/.gitolite.rc /var/lib/gitolite
+ln -sf .gitolite/conf/.gitconfig /var/lib/gitolite