infra/codestorage/hg-ssh

Paddy 2015-10-11 Parent:eeaf3e97ed44 Child:121585c71fd7

1:2f4a2a20ad6d Go to Latest

infra/codestorage/hg-ssh/Dockerfile

Update to be more modular. We updated our Mercurial serving architecture to be a bit more modular. The main difference is that we now are based off the secondbit/hg-repo-sync image, and don't need to do as much setup to get the basics (Mercurial, folders, etc.) We now have a pullkeys.ssh script, which pulls down the SSH keys stored in a specified GCS bucket, and creates users for them. This allows us to update who has push access, without modifying the docker image. We also have a custom run.sh script now, instead of starting sshd directly, because we need to do a few things when starting this up: 1. Modify the permissions on the mounted directories while we're root so SSH users can write and read the committed files. We have to do this at start time instead of at image build time because Kubernetes' volumes don't respect the permissions set at build time. 2. Pull all the repos backed up to GCS to local disk, which means that startup automatically picks up at the last known state. This script is built into the image by secondbit/hg-repo-sync. 3. Pull all the SSH keys from GCS, using the new script. This creates the new users and lets us SSH into the server, while keeping the user definitions separate from the image itself. 4. Finally, start the SSH daemon.

History
1 FROM secondbit/hg-repo-sync
2 MAINTAINER Paddy "<paddy@secondbit.org>"
4 ADD create_user.sh /usr/local/bin/helpers/create_user.sh
5 RUN chmod +x /usr/local/bin/helpers/create_user.sh
6 ADD run.sh /usr/local/bin/helpers/run-ssh.sh
7 RUN chmod +x /usr/local/bin/helpers/run-ssh.sh
8 ADD pullkeys.sh /usr/local/bin/helpers/pullkeys.sh
9 RUN chmod +x /usr/local/bin/helpers/pullkeys.sh
11 RUN mkdir /var/run/sshd
13 # install required packages
14 RUN apt-get -y update
15 RUN apt-get -y install openssh-server
17 #ADD sshd_config /etc/ssh/sshd_config
18 RUN sed -ri 's/session required pam_loginuid.so/session optional pam_loginuid.so/g' /etc/pam.d/sshd
19 RUN sed -ri 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config
20 RUN sed -ri 's/PermitRootLogin without-password/PermitRootLogin no/g' /etc/ssh/sshd_config
22 EXPOSE 22
24 CMD ["/usr/local/bin/helpers/run-ssh.sh"]