# Use an official Debian base image FROM debian:stable-slim # Set environment variables to avoid prompts during installation ENV DEBIAN_FRONTEND=noninteractive # Install required packages RUN apt-get update && \ apt-get install -y \ git \ openssh-server \ && rm -rf /var/lib/apt/lists/* # Create a new user (replace 'git' with your desired username) RUN useradd -m -s /usr/bin/git-shell git && \ mkdir -p /home/git/.ssh && \ chown -R git:git /home/git/.ssh # Set up SSH # COPY sshd_config /etc/ssh/sshd_config RUN echo "PermitRootLogin no" >> /etc/ssh/sshd_config && \ echo "PasswordAuthentication no" >> /etc/ssh/sshd_config && \ echo "ChallengeResponseAuthentication no" && \ echo "UsePAM no" >> /etc/ssh/sshd_config && \ echo "Subsystem git /usr/lib/git-core/git-shell" # Expose SSH port EXPOSE 22 RUN ln -sf /home/git/data/archive /archive COPY gitserver.entrypoint.sh /entrypoint.sh # Start SSH server CMD ["/bin/bash", "/entrypoint.sh"]