Skip to content

Instantly share code, notes, and snippets.

@bryantrobbins
Created August 17, 2015 01:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryantrobbins/6584c9cb63d0fc30c3d6 to your computer and use it in GitHub Desktop.
Save bryantrobbins/6584c9cb63d0fc30c3d6 to your computer and use it in GitHub Desktop.
My Jenkins swarm Docker slave for doing R and Gradle stuff (season to taste)
FROM ubuntu:14.04
MAINTAINER Bryan Robbins <bryantrobbins@gmail.com>
# Get latest packages
RUN echo "deb http://lib.stat.cmu.edu/R/CRAN/bin/linux/ubuntu trusty/" >> /etc/apt/sources.list
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
RUN apt-get update && apt-get clean
# Needed for Jenkins
RUN apt-get install --no-install-recommends openjdk-7-jdk -y
# Needed for Jenkins jobs
RUN apt-get install ant wget unzip bzip2 xvfb git -y
# Needed for R
RUN apt-get install r-base r-base-dev libxml2-dev libcurl3-dev -y
COPY install.r /install.r
RUN Rscript install.r
# Install Gradle
COPY gradle-2.1-bin.zip /gradle-2.1-bin.zip
RUN unzip /gradle-2.1-bin.zip
RUN mv /gradle-2.1 /gradle
ENV PATH $PATH:/gradle/bin
# Set up slave files and user
RUN groupadd -r jslave && useradd -r -g jslave jslave
ADD swarm.jar /home/jslave/swarm.jar
RUN chown -R jslave:jslave /home/jslave
EXPOSE 22
EXPOSE 5005
USER jslave
WORKDIR /home/jslave
CMD ["java", "-jar", "swarm.jar", "-master", "http://yourjenkinsmaster:someport", "-username", "someuser", "-password", "secret", "-labels", "basic R", "-executors", "1", "-fsroot", "/home/jslave/work"]
# I want commands printed in output
options(echo=TRUE)
# Modify this if you have a preferred mirror
cran <- "http://cran.rstudio.com/"
# Modify this list, depending on the R packages you need
install.packages("e1071", repos=cran)
install.packages("rmongodb", repos=cran)
install.packages("ROCR", repos=cran)
install.packages("devtools", repos=cran)
require(devtools)
install_github("Gastrograph/RS3")
@bryantrobbins
Copy link
Author

TODO: Update command to use passwordEnvVariable option instead of hard-coded password

@bryantrobbins
Copy link
Author

You need the Jenkins Swarm client

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment