forked from jkarlosb/git-server-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (22 loc) · 1.09 KB
/
Copy pathDockerfile
File metadata and controls
31 lines (22 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
FROM alpine:latest
LABEL org.opencontainers.image.authors="Oliver Filla <https://github.com/ofilla>, Carlos Bernárdez <carlos@z4studios.com>"
LABEL maintainer='Carlos Bernárdez <carlos@z4studios.com>'
RUN apk add --no-cache openssh git
# -D flag avoids password generation
# -s flag changes user's shell
RUN adduser -D -s /usr/bin/git-shell git \
&& passwd -u git \
&& mkdir -p /git-server/keys /git-server/repos /opt/etc/ssh ~git/.ssh
WORKDIR /git-server/
# This is a login shell for SSH accounts to provide restricted Git access.
# It permits execution only of server-side Git commands implementing the
# pull/push functionality, plus custom commands present in a subdirectory
# named git-shell-commands in the user’s home directory.
# More info: https://git-scm.com/docs/git-shell
COPY --chown=git:git git-shell-commands /home/git/git-shell-commands
# sshd_config file is edited for enable access key and disable access password
COPY sshd_config /etc/ssh/sshd_config
COPY start.sh start.sh
EXPOSE 22
VOLUME ["/git-server/keys", "/opt/etc/ssh", "/git-server/repos"]
CMD ["sh", "start.sh"]