mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-11-10 14:24:28 +00:00
[jenkins] Initial commit of self-upgrading Jenkins
This commit is contained in:
parent
214fcda183
commit
086d9fb4ae
3 changed files with 67 additions and 0 deletions
13
jenkins/Dockerfile
Normal file
13
jenkins/Dockerfile
Normal file
|
@ -0,0 +1,13 @@
|
|||
FROM itzg/ubuntu-openjdk-7
|
||||
|
||||
MAINTAINER itzg
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install curl && apt-get clean
|
||||
|
||||
ADD download-and-start.sh /download-and-start
|
||||
|
||||
ENV JENKINS_HOME /data
|
||||
VOLUME ["/data"]
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["/download-and-start"]
|
25
jenkins/README.md
Normal file
25
jenkins/README.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
A self-upgrading [Jenkins CI](http://jenkins-ci.org/) server
|
||||
|
||||
# Basic Usage
|
||||
|
||||
To start Jenkins with the latest version:
|
||||
|
||||
ID=$(docker run -d -p 8080:8080 itzg/jenkins)
|
||||
|
||||
At a later time, you can upgrade by restarting the container:
|
||||
|
||||
docker stop $ID
|
||||
docker start $ID
|
||||
|
||||
# Attaching host directory to Jenkins home directory
|
||||
|
||||
The Jenkins home directory is attachable at `/data`, so attaching to a host volume
|
||||
would be:
|
||||
|
||||
ID=$(docker run -d -p 8080:8080 -v /SOME_HOST_DIR:/data itzg/jenkins
|
||||
|
||||
# Entering the container to perform manual config
|
||||
|
||||
As with any Docker container, you can run a shell within the running container:
|
||||
|
||||
docker exec -it $ID bash
|
29
jenkins/download-and-start.sh
Executable file
29
jenkins/download-and-start.sh
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash
|
||||
|
||||
mirrorUrl=http://mirrors.jenkins-ci.org/war/latest/jenkins.war
|
||||
url=$(curl -s --head $mirrorUrl|awk -F': ' '$1 == "Location" { print $2 }' | sed 's/[[:space:]]*$//')
|
||||
version=$(echo $url | sed 's#.*/war/\(.*\)/jenkins.war#\1#')
|
||||
|
||||
mkdir -p /opt/jenkins
|
||||
trackingFile=/opt/jenkins/INSTALLED
|
||||
|
||||
installed=
|
||||
if [ -f $trackingFile ]; then
|
||||
installed=$(cat $trackingFile)
|
||||
echo "Version installed is $installed"
|
||||
fi
|
||||
|
||||
if [ $version != "$installed" ]; then
|
||||
echo "Downloading $version from '$url'"
|
||||
while ! curl -s -o /opt/jenkins/jenkins.war "$url"
|
||||
do
|
||||
echo "Trying again in 5 seconds"
|
||||
sleep 5
|
||||
done
|
||||
|
||||
echo $version > $trackingFile
|
||||
fi
|
||||
|
||||
|
||||
cd /opt/jenkins
|
||||
exec java -jar jenkins.war
|
Loading…
Reference in a new issue