blob: 382ad0d8398dbbd2fee6b3e71215911903b3e0af (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
FROM alpine:3.19
# Install OpenSSH server and git
RUN apk add --no-cache openssh git
# Create git user with UID 1000 and set git-shell as login shell
# This restricts the user to git operations only
RUN adduser -D -u 1000 -s /usr/bin/git-shell git && \
mkdir -p /home/git/.ssh /repos && \
chown -R git:git /home/git /repos
# Generate SSH host keys
# These will be regenerated if not persisted via volume mount
RUN ssh-keygen -A
# Copy sshd configuration
COPY sshd_config /etc/ssh/sshd_config
# Expose SSH port
EXPOSE 22
# Run SSH daemon in foreground with error logging to stderr
CMD ["/usr/sbin/sshd", "-D", "-e"]
|