2016-04-06 12:32:01 +02:00
|
|
|
# Run a git server in a container.
|
|
|
|
#
|
|
|
|
# docker run --rm -it -p 1234:22 \
|
|
|
|
# -e DEBUG=true \
|
|
|
|
# -e "PUBKEY=$(cat ~/.ssh/id_ed25519.pub)" \
|
|
|
|
# --name gitserver \
|
|
|
|
# jess/gitserver
|
|
|
|
FROM alpine:latest
|
2016-09-20 00:25:05 +02:00
|
|
|
MAINTAINER Jessie Frazelle <jess@linux.com>
|
2016-04-06 12:32:01 +02:00
|
|
|
|
|
|
|
ENV HOME /root
|
|
|
|
|
2016-06-06 05:40:20 +02:00
|
|
|
RUN apk --no-cache add \
|
2016-04-06 12:32:01 +02:00
|
|
|
git \
|
|
|
|
openssh \
|
|
|
|
&& sed -i "s/#PasswordAuthentication yes/PasswordAuthentication no/" /etc/ssh/sshd_config \
|
|
|
|
&& sed -i "s/#PubkeyAuthentication yes/PubkeyAuthentication yes/" /etc/ssh/sshd_config \
|
|
|
|
&& echo -e "AllowUsers git\n" >> /etc/ssh/sshd_config \
|
|
|
|
&& echo -e "Port 22\n" >> /etc/ssh/sshd_config \
|
|
|
|
&& addgroup git \
|
|
|
|
&& adduser -D -S -s /usr/bin/git-shell -h /home/git -g git git \
|
|
|
|
&& mkdir -p /home/git/.ssh \
|
|
|
|
&& chown -R git:git /home/git \
|
2016-04-07 03:05:56 +02:00
|
|
|
&& passwd -u git
|
2016-04-06 12:32:01 +02:00
|
|
|
|
|
|
|
ENV HOME /home/git
|
|
|
|
EXPOSE 22
|
|
|
|
WORKDIR $HOME
|
|
|
|
|
|
|
|
COPY ./start.sh /
|
2016-04-07 03:05:56 +02:00
|
|
|
COPY create_repo /usr/bin/create_repo
|
2016-04-06 12:32:01 +02:00
|
|
|
|
|
|
|
ENTRYPOINT ["/start.sh"]
|
|
|
|
CMD ["/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_config"]
|