Skip to content

Commit

Permalink
- no need for jenkins-slave to have Docker installed as you can use t…
Browse files Browse the repository at this point in the history
…he installation from the host

- added image with headless Firefox installation
  • Loading branch information
Krijger committed May 14, 2014
1 parent 81842a7 commit 7e665a0
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 0 deletions.
8 changes: 8 additions & 0 deletions firefox-jenkins-slave/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM quintenk/jenkins-slave

MAINTAINER Quinten Krijger "https://github.com/Krijger
RUN apt-get -y install firefox xvfb
ADD xvfb.sv.conf /etc/supervisor/conf.d/
CMD supervisord -c /etc/supervisor.conf
27 changes: 27 additions & 0 deletions firefox-jenkins-slave/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Complete image to run Jenkins as a slave with headless Firefox
==============================================================

Installed are:
- Supervisord (inherited)
- Oracle Java 7 Development Kit (inherited)
- Firefox
- Xvfb headless display driver

Run with access to Docker on the host
-------------------------------------

docker run
-v /run/docker.sock:/run/docker.sock
-v /usr/bin/docker:/usr/bin/docker
[-v ${absolute path to the jenkins directory - helpful for restarts}:/var/jenkins]
-e JENKINS_PORT_8080_TCP_ADDR=${host for master jenkins}
[-e JENKINS_PORT_8080_TCP_PORT=${port for master jenkins, defaults to 8080}]
-e SLAVE_NAME=${slave name, you name the slave when creating the node on the master jenkins}
[-e JENKINS_SECRET=${secret for jenkins - if needed you can find this in the information page for the slave node (on master)}]
-d quintenk/firefox-jenkins-slave

or skip the two -v options if you don't need Docker from the host




3 changes: 3 additions & 0 deletions firefox-jenkins-slave/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

docker build -t quintenk/firefox-jenkins-slave .
2 changes: 2 additions & 0 deletions firefox-jenkins-slave/xvfb.sv.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[program:xvfb]
command=/bin/bash -c "Xvfb :10 -ac"
8 changes: 8 additions & 0 deletions jenkins-slave/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM quintenk/jdk-oracle:7

MAINTAINER Quinten Krijger "https://github.com/Krijger
ADD runslave.sh /usr/local/bin/runslave
RUN chmod +x /usr/local/bin/runslave
ADD jenkins-slave.sv.conf /etc/supervisor/conf.d/
CMD supervisord -c /etc/supervisor.conf
23 changes: 23 additions & 0 deletions jenkins-slave/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Complete image to run Jenkins as a slave
========================================

Installed are:
- Supervisord (inherited)
- Oracle Java 7 Development Kit (inherited)
- Firefox
- Xvfb headless display driver

Run with access to Docker on the host
-------------------------------------

docker run
-v /run/docker.sock:/run/docker.sock
-v /usr/bin/docker:/usr/bin/docker
[-v ${absolute path to the jenkins directory - helpful for restarts}:/var/jenkins]
-e JENKINS_PORT_8080_TCP_ADDR=${host for master jenkins}
[-e JENKINS_PORT_8080_TCP_PORT=${port for master jenkins, defaults to 8080}]
-e SLAVE_NAME=${slave name, you name the slave when creating the node on the master jenkins}
[-e JENKINS_SECRET=${secret for jenkins - if needed you can find this in the information page for the slave node (on master)}]
-d quintenk/jenkins-slave

or skip the two -v options if you don't need Docker from the host
3 changes: 3 additions & 0 deletions jenkins-slave/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

docker build -t quintenk/jenkins-slave .
2 changes: 2 additions & 0 deletions jenkins-slave/jenkins-slave.sv.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[program:jenkins-slave]
command=/bin/bash -c "runslave"
20 changes: 20 additions & 0 deletions jenkins-slave/runslave.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
set -x

JENKINS_AUTHORITY=${JENKINS_PORT_8080_TCP_ADDR}:${JENKINS_PORT_8080_TCP_PORT:-8080}
SLAVE_JAR_URL="http://${JENKINS_AUTHORITY}/jnlpJars/slave.jar"
JNLP_URL="http://${JENKINS_AUTHORITY}/computer/${SLAVE_NAME}/slave-agent.jnlp"

VAR_LIB_JENKINS="/var/lib/jenkins"
SLAVE_JAR="${VAR_LIB_JENKINS}/slave.jar"

if [ ! -f ${SLAVE_JAR} ] ; then
mkdir -p ${VAR_LIB_JENKINS}
wget --retry-connrefused -t inf ${SLAVE_JAR_URL} -O ${SLAVE_JAR}
fi

if [[ $JENKINS_SECRET ]] ; then
java -jar ${SLAVE_JAR} -jnlpUrl ${JNLP_URL} -secret ${JENKINS_SECRET}
else
java -jar ${SLAVE_JAR} -jnlpUrl ${JNLP_URL}
fi

0 comments on commit 7e665a0

Please sign in to comment.