blob: 6d7169f80fb9ed4d6aa08408f84fc8584df74289 [file] [log] [blame]
Ian Maxonab006162019-04-04 21:00:41 -07001FROM centos:7.2.1511
2
3USER root
4
5RUN yum install -y openssh-server openssh-clients unzip git which
6
7# Set up for SSH daemon
8RUN sed -ri -e 's/UsePAM yes/#UsePAM yes/g' \
9 -e 's/#UsePAM no/UsePAM no/g' \
10 -e 's/^GSS/#GSS/' \
11 -e '/ssh_host_ed25519_key/d' \
12 /etc/ssh/sshd_config && \
13 ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa && \
14 ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa && \
15 ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
16
17# -e 's@#HostKey /etc/ssh/ssh_host_dsa_key@HostKey /etc/ssh/ssh_host_dsa_key@g' \
18
19# JDK.
20RUN mkdir /tmp/deploy && \
21 cd /tmp/deploy && \
22 curl -L --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \
23 http://download.oracle.com/otn-pub/java/jdk/8u102-b14/jdk-8u102-linux-x64.rpm \
24 -o jdk.rpm && \
25 yum localinstall -y jdk.rpm && \
26 cd /tmp && rm -rf deploy
27ENV JAVA_HOME=/usr/java/latest
28
29# create jenkins user
30RUN groupadd -g1000 jenkins && \
31 useradd jenkins -g jenkins -u1000 -m -s /bin/bash && \
32 echo "jenkins:$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo)" | chpasswd
33
34COPY startup.sh /usr/sbin/
35COPY ssh/* /home/jenkins/.ssh/
36RUN chown -R jenkins:jenkins /home/jenkins/.ssh && \
37 chmod 600 /home/jenkins/.ssh/*
38
39# Configure password-less ssh for user jenkins
40USER jenkins
41RUN ssh-keygen -q -t rsa -P "" < /dev/zero && \
42 cat /home/jenkins/.ssh/id_rsa.pub >> /home/jenkins/.ssh/authorized_keys && \
43 chmod 600 /home/jenkins/.ssh/authorized_keys
44
45# Configure the Jenkins non-interactive logins with UTF-8
46RUN echo "export LANG=en_US.UTF-8" >> /home/jenkins/.bashrc
47
48USER root
49ENTRYPOINT [ "/usr/sbin/startup.sh" ]
50CMD [ "default" ]
51EXPOSE 22 8000-8003