Skip to content

Instantly share code, notes, and snippets.

@chancez
Created September 13, 2024 15:42
Show Gist options
  • Save chancez/c2fd93e3fad59b78f5e7b2cba9b1d23c to your computer and use it in GitHub Desktop.
Save chancez/c2fd93e3fad59b78f5e7b2cba9b1d23c to your computer and use it in GitHub Desktop.
FROM debian:12-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN adduser git --home /srv/git && \
chown -R git:git /srv/git
RUN apt-get update && \
apt-get install --yes --no-install-recommends --no-install-suggests git openssh-server && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
sed -i 's/#AuthorizedKeysFile.*/AuthorizedKeysFile \/etc\/ssh\/keys\/%u\/authorized_keys/' /etc/ssh/sshd_config && \
mkdir /run/sshd
ADD id_ed25519.pub /etc/ssh/keys/git/authorized_keys
ADD ssh_host_* /etc/ssh
EXPOSE 22
VOLUME ["/srv/git"]
CMD ["/usr/sbin/sshd", "-D", "-e"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment