summaryrefslogtreecommitdiffstats
path: root/docker/Dockerfile.gitolite
blob: 66367b5f56ef5b42552cc8b996adbcefec7850f9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# 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 -- 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
VOLUME /var/lib/gitolite

# sshd host keys are stored in a volume so that rebuilding/updating the
# image doesn't break user trust
COPY sshd_config /etc/ssh/
RUN mkdir -p /hostkeys/etc/ssh/
RUN ssh-keygen -A -f /hostkeys
VOLUME /hostkeys

EXPOSE 22
CMD ["/usr/bin/sshd", "-D"]