Skip to content

Instantly share code, notes, and snippets.

@MattJermyWright
Last active March 22, 2019 17:30
Show Gist options
  • Save MattJermyWright/fc58801b1da05e08f0718dc9bfa42e14 to your computer and use it in GitHub Desktop.
Save MattJermyWright/fc58801b1da05e08f0718dc9bfa42e14 to your computer and use it in GitHub Desktop.
General: Updated Jenkins Setup
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
FROM ubuntu:18.04
RUN apt-get update && apt-get install -y wget git curl
RUN apt-get update && apt-get install -y --no-install-recommends openjdk-8-jdk
RUN apt-get update && apt-get install -y maven ant ruby rbenv make
RUN wget -q -O - http://pkg.jenkins-ci.org/debian-stable/jenkins-ci.org.key | apt-key add -
RUN echo deb http://pkg.jenkins-ci.org/debian-stable binary/ >> /etc/apt/sources.list
RUN apt-get update && apt-get install -y jenkins
RUN mkdir -p /var/jenkins_home && chown -R jenkins /var/jenkins_home
ADD init.groovy /tmp/WEB-INF/init.groovy
RUN apt-get install -y zip && cd /tmp && zip -g /usr/share/jenkins/jenkins.war WEB-INF/init.groovy
USER jenkins
# Install PyENV
RUN git clone https://github.com/pyenv/pyenv.git ~/.pyenv
ADD bash_profile_jenkins.sh /var/lib/jenkins/.bashrc
RUN /bin/bash -c "source /var/lib/jenkins/.bashrc && pyenv install anaconda3-2018.12"
RUN /bin/bash -c "source /var/lib/jenkins/.bashrc && pyenv global anaconda3-2018.12"
RUN /bin/bash -c "source /var/lib/jenkins/.bashrc && pip install loguru boto3 awscli"
# RUN pip install loguru
# RUN pip install boto3
# RUN pip install awscli
# VOLUME /var/jenkins_home - bind this in via -v if you want to make this persistent.
ENV JENKINS_HOME /var/jenkins_home
# for main web interface:
EXPOSE 8080
# will be used by attached slave agents:
EXPOSE 50000
CMD ["/usr/bin/java", "-jar", "/usr/share/jenkins/jenkins.war"]
import hudson.model.*;
import jenkins.model.*;
println "--> setting agent port for jnlp"
Jenkins.instance.setSlaveAgentPort(50000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment