summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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