aboutsummaryrefslogtreecommitdiff
path: root/gitolite/Dockerfile
blob: 8ac87f60d23fd20e005db918b1a7bef69674e212 (plain)
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
32
33
34
FROM alpine:3.23.3

# Install OpenSSH server and Gitolite
# Unlock the automatically-created git user
RUN set -x \
 && apk add --no-cache openrc fail2ban gitolite openssh

RUN apk update && apk update

RUN rc-update add fail2ban

RUN git config --system advice.defaultBranchName false

# Volume used to store SSH host keys, generated on first run
VOLUME /etc/ssh/keys

# Volume used to store all Gitolite data (keys, config and repositories), initialized on first run
VOLUME /var/lib/git

# Permissions are fixed in docker-entrypoint.sh
RUN mkdir -p /var/lib/git/local/hooks/common
COPY post-receive /var/lib/git/local/hooks/common/
RUN chmod +x /var/lib/git/local/hooks/common/post-receive

# Entrypoint responsible for SSH host keys generation, and Gitolite data initialization
COPY docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]

# Expose port 22 to access SSH
EXPOSE 22

# Default command is to run the SSH server
CMD ["sshd"]