Skip to content

Commit

Permalink
Continue adding master node Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
knjname committed May 3, 2014
1 parent d4b06b5 commit 7aa2d99
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

# Jenkins over Docker example




2 changes: 1 addition & 1 deletion master/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ ADD http://mirrors.jenkins-ci.org/war/latest/jenkins.war /jenkins/bin/jenkins.wa
ADD resources/run.sh /jenkins/bin/run.sh

# Declarations
CMD /jenkins/bin/run.sh
CMD bash /jenkins/bin/run.sh


9 changes: 8 additions & 1 deletion master/dockerrun.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/bin/bash

docker run --name "jenkins-master" -d -t knjname/jenkinsmaster
docker run \
--name "jenkins-master" \
-p 8080:8080 \
-p 10080:10080 \
-e JENKINS_JNLP_PORT=10080 \
-d \
knjname/jenkins-master


11 changes: 6 additions & 5 deletions master/resources/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
: ${JENKINS_JNLP_PORT:=""}
JENKINS_CONFIG_XML="${JENKINS_HOME}/config.xml"


## Type: string
## Default: ""
## ServiceRestart: jenkins
Expand Down Expand Up @@ -203,9 +204,9 @@ JENKINS_AJP_LISTEN_ADDRESS=""


# Check whether fundamental conditions are satisfied.
test -r "$JENKINS_WAR" || { echo "$JENKINS_WAR not installed"; exit 5 }
[ -n "$JENKINS_HOME" ] || { echo "JENKINS_HOME not configured in $JENKINS_CONFIG"; exit 6 }
[ -d "$JENKINS_HOME" ] || { echo "JENKINS_HOME directory does not exist: $JENKINS_HOME"; exit 1 }
[ -r "$JENKINS_WAR" ] || { echo "$JENKINS_WAR not installed"; exit 5 ; }
[ -n "$JENKINS_HOME" ] || { echo "JENKINS_HOME not configured in $JENKINS_CONFIG"; exit 6 ; }
[ -d "$JENKINS_HOME" ] || { echo "JENKINS_HOME directory does not exist: $JENKINS_HOME"; exit 1 ; }

# Search usable Java. We do this because various reports indicated
# that /usr/bin/java may not always point to Java 1.5
Expand All @@ -218,7 +219,7 @@ done

# Construct the arguments to be given to Jenkins.
JAVA_CMD="$JENKINS_JAVA_CMD $JENKINS_JAVA_OPTIONS -DJENKINS_HOME=$JENKINS_HOME -jar $JENKINS_WAR"
PARAMS="--logfile=${JENKINS_LOG_DIR}/jenkins.log --webroot=/var/cache/jenkins/war --daemon"
PARAMS="--logfile=${JENKINS_LOG_DIR}/jenkins.log --webroot=/var/cache/jenkins/war"
[ -n "$JENKINS_PORT" ] && PARAMS="$PARAMS --httpPort=$JENKINS_PORT"
[ -n "$JENKINS_LISTEN_ADDRESS" ] && PARAMS="$PARAMS --httpListenAddress=$JENKINS_LISTEN_ADDRESS"
[ -n "$JENKINS_HTTPS_PORT" ] && PARAMS="$PARAMS --httpsPort=$JENKINS_HTTPS_PORT"
Expand Down Expand Up @@ -251,7 +252,7 @@ if ! [ -f "${JENKINS_CONFIG_XML}" ] ; then
EOF
fi
if [ -n "${JENKINS_JNLP_PORT}" ] ; then
sed -i 's|<slaveAgentPort>.*</slaveAgentPort>|<slaveAgentPort>${JENKINS_JNLP_PORT}</slaveAgentPort>|' "${JENKINS_CONFIG_XML}"
sed -i "s|<slaveAgentPort>.*</slaveAgentPort>|<slaveAgentPort>${JENKINS_JNLP_PORT}</slaveAgentPort>|" "${JENKINS_CONFIG_XML}"
fi

# Launch the Jenkins!
Expand Down

0 comments on commit 7aa2d99

Please sign in to comment.