First commit
This commit is contained in:
commit
3b22c1a5d7
20
Dockerfile
Normal file
20
Dockerfile
Normal 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"]
|
||||
9
README.txt
Normal file
9
README.txt
Normal file
@ -0,0 +1,9 @@
|
||||
This Dockerfile is intended to sping up an SSH server with git installed to server as a git server.
|
||||
|
||||
The process of using and setting up this solution has been detailed in the below article:
|
||||
https://96-fromsofia.net/articles/git-to-ecs/
|
||||
|
||||
To build the container:
|
||||
$ podman build -t git-server .
|
||||
|
||||
If you have any question regarding this build you can email me at: 2a9-7cc@96-fromsofia.net
|
||||
0
ssh-key.pub
Normal file
0
ssh-key.pub
Normal file
Loading…
Reference in New Issue
Block a user