Added git server and prometheus metrics
This commit is contained in:
36
gitserver.Dockerfile
Normal file
36
gitserver.Dockerfile
Normal file
@@ -0,0 +1,36 @@
|
||||
# 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"]
|
||||
|
||||
Reference in New Issue
Block a user