2019-12-22 21:00:24 +00:00
|
|
|
FROM alpine:latest
|
|
|
|
|
2019-12-25 01:20:48 +00:00
|
|
|
RUN apk add \
|
|
|
|
git \
|
|
|
|
apache2 \
|
|
|
|
openssh \
|
|
|
|
cgit \
|
|
|
|
py3-markdown \
|
|
|
|
py3-pygments \
|
|
|
|
curl \
|
|
|
|
vim \
|
|
|
|
jq
|
2019-12-22 21:00:24 +00:00
|
|
|
|
2019-12-22 21:37:32 +00:00
|
|
|
COPY sshd_config /sshd_config
|
2019-12-22 21:00:24 +00:00
|
|
|
COPY httpd.conf /etc/apache2/httpd.conf
|
|
|
|
COPY cgitrc /etc/cgitrc
|
|
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
|
|
COPY update-mirrors.sh /update-mirrors.sh
|
|
|
|
|
|
|
|
# Create directory for cgit config
|
|
|
|
RUN mkdir -p /etc/cgit.d
|
|
|
|
|
|
|
|
# Add git user with home directory ready for SSH config and a random password.
|
|
|
|
# The password won't actually be used for anything, but needs to be set for
|
|
|
|
# the system to consider the account valid.
|
|
|
|
RUN adduser -Dh /git -s /usr/bin/git-shell git && \
|
|
|
|
echo "git:\$(date +%s | sha256sum | base64 | head -c 64 ; echo)" | chpasswd
|
|
|
|
|
|
|
|
# Add the cronjob to update the git mirrors once per hour
|
|
|
|
RUN echo -e "0 * * * * /update-mirrors.sh\n" | crontab -u git -
|
|
|
|
|
|
|
|
RUN mkdir -p /pub/git && \
|
|
|
|
chown -R git:git /pub/git
|
|
|
|
|
|
|
|
# Used to allow customization of cgit
|
|
|
|
VOLUME /etc/cgit.d
|
|
|
|
# Used to persist host SSH keys and configuration
|
|
|
|
VOLUME /etc/ssh
|
|
|
|
# Used to persist public SSH keys
|
2019-12-22 21:56:33 +00:00
|
|
|
VOLUME /git
|
2019-12-22 21:00:24 +00:00
|
|
|
# Used to persist git repositories
|
|
|
|
VOLUME /pub/git
|
|
|
|
|
|
|
|
EXPOSE 22
|
|
|
|
EXPOSE 80
|
|
|
|
|
|
|
|
CMD /entrypoint.sh
|
|
|
|
|