-
-
Save Eugene-Shapovalov/db0dc890289286aba3ecaf49c0ac6028 to your computer and use it in GitHub Desktop.
Jenkins and RVM with Ruby 2.2.3 - Docker image
This file contains hidden or 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
# v1.0 | |
# November 21, 2015 | |
FROM jenkins:latest | |
MAINTAINER NickGnd "[email protected]" | |
# https://github.com/jenkinsci/docker/blob/4fa9ebc13069fa8186728622cd63702cddf11162/Dockerfile | |
ENV RUBY_VERSION 2.2.3 | |
# --handlerCountStartup = set the no of worker threads to spawn at startup. Default is 5 | |
# --handlerCountMax = set the max no of worker threads to allow. Default is 300 | |
# --handlerCountMaxIdle = set the max no of idle worker threads to allow. Default is 50 | |
ENV JENKINS_OPTS="--handlerCountStartup=5 --handlerCountMax=100 --logfile=/var/log/jenkins/jenkins.log" | |
ENV PATH $PATH:/usr/local/rvm/bin | |
# Add custom bashrc | |
RUN rm /var/jenkins_home/.bashrc | |
ADD ./utils/bashrc_rvm /var/jenkins_home/.bashrc | |
USER root | |
# change default bash | |
RUN rm /bin/sh && ln -s /bin/bash /bin/sh | |
# Install essentials packages | |
# RUN apt-get update && apt-get install DEBIAN_FRONTEND=noninteractive install -yq build-essential curl gnupg git vim | |
RUN apt-get update -q \ | |
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \ | |
build-essential \ | |
curl \ | |
gnupg \ | |
git \ | |
vim | |
# Install mysql client (no server) | |
RUN DEBIAN_FRONTEND=noninteractive apt-get install -yq mysql-client libmysqlclient-dev | |
# Download RVM as root | |
RUN curl -#LO https://rvm.io/mpapis.asc && gpg --import mpapis.asc | |
RUN \curl -sSL https://get.rvm.io | bash -s stable | |
# Install RVM requirements | |
RUN /bin/bash -lc "rvm requirements" | |
# Add jenkins to rvm group | |
RUN usermod -a -G rvm jenkins | |
USER jenkins | |
# Install Ruby | |
RUN /bin/bash -lc "rvm install $RUBY_VERSION && rvm use $RUBY_VERSION --default" | |
# Set no doc for gem | |
RUN echo "gem: --no-rdoc --no-ri" >> ~/.gemrc | |
# Install bundler | |
RUN /bin/bash -lc "gem install bundler --no-doc --no-ri" | |
# Jenkins home directoy is a volume, so configuration and build history | |
# can be persisted and survive image upgrades | |
VOLUME /var/jenkins_home | |
USER root | |
RUN chown -R jenkins /var/jenkins_home | |
# Add Jenkins Log folder | |
RUN mkdir /var/log/jenkins \ | |
&& touch /var/log/jenkins/jenkins.log \ | |
&& chown -R jenkins:jenkins /var/log/jenkins | |
# slim down image | |
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man/?? /usr/share/man/??_* | |
# Already exposed 8080 & 50000 ports in Jenkins image |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment