# 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
RUN runuser -u gitolite -- ln -sf .gitolite/conf/.gitolite.rc /var/lib/gitolite
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"]