First commit

This commit is contained in:
Git Commiter for 96-fromsofia.net
2023-02-27 01:06:39 +00:00
commit 3b22c1a5d7
3 changed files with 29 additions and 0 deletions

20
Dockerfile Normal file
View File

@@ -0,0 +1,20 @@
# Select base image and install your packages
FROM ubi9:latest
RUN yum install -y git openssh-server
RUN ssh-keygen -A
# Setup the git user and create the git repo mount target
RUN useradd -s `which git-shell` -u 3091 git
RUN mkdir -p /srv/git
# Add your public key for passwordless ssh authentication with git interactions
RUN mkdir /home/git/.ssh && chmod 700 /home/git/.ssh
ADD ./ssh-key.pub /home/git/.ssh/authorized_keys
RUN chmod 600 /home/git/.ssh/authorized_keys && chown git:git -R /home/git/.ssh
# Secure git-shell against: CVE-2017-8386
RUN sed -i '1s/^/no-pty /g' /home/git/.ssh/authorized_keys
# Expose port 22 and run the ssh daemon
EXPOSE 22
CMD ["/usr/sbin/sshd","-D"]