Skip to content

Instantly share code, notes, and snippets.

@mulloymorrow
Created May 17, 2016 19:04
Show Gist options
  • Save mulloymorrow/dc530a9ecf60eea0e66d8182ebd1df75 to your computer and use it in GitHub Desktop.
Save mulloymorrow/dc530a9ecf60eea0e66d8182ebd1df75 to your computer and use it in GitHub Desktop.
FROM ubuntu:15.04
MAINTAINER Mulloy Morrow <mulloy@offerup.com>
#################################################
# Inspired by
# https://hub.docker.com/r/cloudbees/java-build-tools/
#################################################
#================================================
# Customize sources for apt-get
#================================================
RUN echo "deb http://archive.ubuntu.com/ubuntu vivid main universe\n" > /etc/apt/sources.list \
&& echo "deb http://archive.ubuntu.com/ubuntu vivid-updates main universe\n" >> /etc/apt/sources.list
#========================
# Miscellaneous packages
# iproute which is surprisingly not available in ubuntu:15.04 but is available in ubuntu:latest
# OpenJDK8
# groff is for aws-cli
# tree is convenient for troubleshooting builds
#========================
RUN apt-get update -qqy \
&& apt-get -qqy --no-install-recommends install \
iproute \
openssh-client ssh-askpass\
ca-certificates \
openjdk-8-jdk \
tar zip unzip \
wget curl \
git \
build-essential \
less nano tree \
python python-pip virtualenv \
python-dev libssl-dev libssl1.0.0 libffi-dev groff \
netcat-openbsd \
&& rm -rf /var/lib/apt/lists/* \
&& sed -i 's/securerandom\.source=file:\/dev\/random/securerandom\.source=file:\/dev\/urandom/' ./usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/java.security \
&& ln -s /lib/x86_64-linux-gnu/libssl.so.1.0.0 /lib/x86_64-linux-gnu/libssl.so.10 \
&& ln -s /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /lib/x86_64-linux-gnu/libcrypto.so.10 \
# workaround https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=775775
RUN [ -f "/etc/ssl/certs/java/cacerts" ] || /var/lib/dpkg/info/ca-certificates-java.postinst configure
#==========
# Maven
#==========
ENV MAVEN_VERSION 3.3.9
RUN curl -fsSL http://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz | tar xzf - -C /usr/share \
&& mv /usr/share/apache-maven-$MAVEN_VERSION /usr/share/maven \
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
ENV MAVEN_HOME /usr/share/maven
#==========
# Selenium
#==========
RUN mkdir -p /opt/selenium \
&& wget --no-verbose http://selenium-release.storage.googleapis.com/2.49/selenium-server-standalone-2.49.1.jar -O /opt/selenium/selenium-server-standalone.jar
#========================================
# Add normal user with passwordless sudo
#========================================
RUN useradd jenkins --shell /bin/bash --create-home \
&& usermod -a -G sudo jenkins \
&& echo 'ALL ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers \
&& echo 'jenkins:secret' | chpasswd
# https://raw.githubusercontent.com/SeleniumHQ/docker-selenium/master/NodeFirefox/Dockerfile
#===============
# XVFB & FIREFOX
#===============
RUN apt-get update -qqy \
&& apt-get -qqy --no-install-recommends install \
xvfb firefox \
&& rm -rf /var/lib/apt/lists/*
#========================
# Selenium Configuration
#========================
COPY config.json /opt/selenium/config.json
ENV SCREEN_WIDTH 1360
ENV SCREEN_HEIGHT 1020
ENV SCREEN_DEPTH 24
ENV DISPLAY :99.0
# https://github.com/SeleniumHQ/docker-selenium/blob/master/StandaloneFirefox/Dockerfile
#====================================
# Scripts to run Selenium Standalone
#====================================
COPY entry_point.sh /opt/bin/entry_point.sh
RUN chmod +x /opt/bin/entry_point.sh
#====================================
# Cloud Foundry CLI
# https://github.com/cloudfoundry/cli
#====================================
RUN wget -O - "http://cli.run.pivotal.io/stable?release=linux64-binary&source=github" | tar -C /usr/local/bin -zxf -
#====================================
# AWS CLI
#====================================
RUN pip install awscli
# compatibility with CloudBees AWS CLI Plugin which expects pip to be installed as user
RUN mkdir -p /home/jenkins/.local/bin/ \
&& ln -s /usr/bin/pip /home/jenkins/.local/bin/pip \
&& chown -R jenkins:jenkins /home/jenkins/.local
#====================================
# NODE JS
# See https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
#====================================
RUN curl -sL https://deb.nodesource.com/setup_4.x | bash \
&& apt-get install -y nodejs
#====================================
# BOWER, GRUNT, GULP
#====================================
RUN npm install --global grunt-cli@0.1.13 bower@1.7.2 gulp@3.9.0
#====================================
# Kubernetes CLI
# See http://kubernetes.io/v1.0/docs/getting-started-guides/aws/kubectl.html
#====================================
#RUN curl https://storage.googleapis.com/kubernetes-release/release/v1.1.4/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl
#====================================
# OPENSHIFT V3 CLI
# Only install "oc" executable, don't install "openshift", "oadmin"...
#====================================
RUN mkdir /var/tmp/openshift \
&& wget -O - "https://github.com/openshift/origin/releases/download/v1.1.1/openshift-origin-client-tools-v1.1.1-e1d9873-linux-64bit.tar.gz" \
| tar -C /var/tmp/openshift --strip-components=1 -zxf - \
&& mv /var/tmp/openshift/oc /usr/local/bin \
&& rm -rf /var/tmp/openshift
#====================================
# JMETER
#====================================
RUN mkdir /opt/jmeter \
&& wget -O - "https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-2.13.tgz" \
| tar -xz --strip=1 -C /opt/jmeter
#====================================
# POSTGRES CLIENT
#====================================
RUN apt-get update -qqy \
&& apt-get -qqy --no-install-recommends install \
postgresql postgresql-contrib phppgadmin \
&& rm -rf /var/lib/apt/lists/*
#====================================
# DOCKER
#====================================
RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
RUN echo 'deb https://apt.dockerproject.org/repo ubuntu-vivid main' >/etc/apt/sources.list.d/docker.list
RUN apt-get update -qqy \
&& apt-get -qqy purge lxc-docker \
&& apt-cache policy docker-engine
#RUN apt-get -qqy --no-install-recommends install linux-image-extra-$(uname -r)
RUN apt-get -qqy --no-install-recommends install docker-engine
RUN update-rc.d docker defaults
RUN gpasswd -a jenkins docker
USER jenkins
# for dev purpose
#USER root
ENTRYPOINT ["/opt/bin/entry_point.sh"]
EXPOSE 4444
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment