-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile
32 lines (26 loc) · 1.16 KB
/
Dockerfile
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
## Standard phusion part
FROM phusion/baseimage:latest
ENV HOME /root
RUN /etc/my_init.d/00_regen_ssh_host_keys.sh -f && rm -f /etc/service/sshd/down # Uncomment to Enable SSHD
#RUN rm -rf /etc/service/sshd /etc/my_init.d/00_regen_ssh_host_keys.sh # Uncomment to Disable SSHD
CMD ["/sbin/my_init"]
## Expose ports.
EXPOSE 22
## Application specific part
MAINTAINER Stephen Day <[email protected]>
WORKDIR /tmp
RUN apt-get -qq update && apt-get -qq upgrade
RUN apt-get -qq install git-sh git sharutils
## Setup service
# Setup a git user and SSH
RUN groupadd -g 987 git && useradd -g git -u 987 -d /git -m -r -s /usr/bin/git-shell git
RUN sed -i -e 's/.*LogLevel.*/LogLevel VERBOSE/' -e 's/#*PermitRootLogin.*/PermitRootLogin no/' /etc/ssh/sshd_config
RUN sed -i -e 's/#UsePAM.*/UsePAM no/' /etc/ssh/sshd_config
#Set a long random password to unlock the git user account
RUN usermod -p `dd if=/dev/urandom bs=1 count=30 | uuencode -m - | head -2 | tail -1` git
## Remove /etc/motd
RUN rm -rf /etc/update-motd.d /etc/motd /etc/motd.dynamic
RUN ln -fs /dev/null /run/motd.dynamic
## Clean up
WORKDIR /
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*