Last active
April 14, 2016 04:49
-
-
Save geoHeil/1752b46d6d38bdbbc460556e38263bc3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM centos:7 | |
MAINTAINER Georg Heiler <georg.heiler@convista.com> | |
# Install Essentials | |
RUN yum update -y && \ | |
yum clean all | |
# Install Packages | |
RUN yum install -y git && \ | |
yum install -y wget && \ | |
yum install -y which && \ | |
yum install -y openssh-server && \ | |
yum install -y java-1.8.0-openjdk && \ | |
yum install -y java-1.8.0-openjdk-devel && \ | |
yum install -y sudo && \ | |
yum clean all | |
# gen dummy keys, centos doesn't autogen them like ubuntu does | |
RUN /usr/bin/ssh-keygen -A | |
# Set SSH Configuration to allow remote logins without /proc write access | |
RUN sed -ri 's/^session\s+required\s+pam_loginuid.so$/session optional pam_loginuid.so/' /etc/pam.d/sshd | |
# Create Jenkins User | |
RUN useradd jenkins -m -s /bin/bash | |
# Add public key for Jenkins login | |
RUN mkdir /home/jenkins/.ssh | |
COPY /files/authorized_keys /home/jenkins/.ssh/authorized_keys | |
RUN chown -R jenkins /home/jenkins | |
RUN chgrp -R jenkins /home/jenkins | |
RUN chmod 600 /home/jenkins/.ssh/authorized_keys | |
RUN chmod 700 /home/jenkins/.ssh | |
# Add the jenkins user to sudoers | |
RUN echo "jenkins ALL=(ALL) ALL" >> etc/sudoers | |
# Set Name Servers | |
COPY /files/resolv.conf /etc/resolv.conf | |
# Set docker sock volumes needed for linux host as the compose-yml file is not used by jenkins to start a job | |
VOLUME /var/run/docker.sock | |
VOLUME /var/lib/docker | |
ENV JAVA_HOME=/usr/lib/jvm/jre | |
# Expose SSH port and run SSHD | |
EXPOSE 22 | |
CMD ["/usr/sbin/sshd","-D"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment