From 43af70bcc61ed1ef8328af93f651cbb1a86c018e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Erik=20Hedenstr=C3=B6m?= <erik@codemate.se>
Date: Tue, 2 Sep 2014 15:26:49 +0200
Subject: [PATCH] Switched to codemate java base. Upgraded buildtools, added
 node and go.

---
 .dockerignore                 |  5 +++++
 Dockerfile                    | 38 +++++++++--------------------------
 install/00_base.sh            |  6 ++----
 install/01_jenkins_user.sh    |  4 +++-
 install/10_build_essential.sh |  3 +--
 install/12_chrome_xvfb.sh     |  4 ++--
 install/20_ant.sh             |  4 ++--
 install/21_maven.sh           |  4 ++--
 install/22_gradle.sh          |  8 ++++----
 install/30_android.sh         |  6 +++---
 install/40_erlang.sh          | 19 ++++++------------
 install/50_nodejs.sh          |  5 +++++
 install/60_golang.sh          |  5 +++++
 install/99_cleanup.sh         | 10 ++++-----
 install/maven/settings.xml    | 11 +---------
 15 files changed, 56 insertions(+), 76 deletions(-)
 create mode 100644 .dockerignore
 create mode 100644 install/50_nodejs.sh
 create mode 100644 install/60_golang.sh

diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..3e60b4e
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,5 @@
+.git
+LICENSE
+VERSION
+README.md
+Changelog.md
diff --git a/Dockerfile b/Dockerfile
index a5858a2..bd678a6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,44 +1,26 @@
 # Jenkins Slave
 #
 # REPOSITORY registry.codemate.se/jenkins-slave
-# VERSION 1.1.0
+# VERSION 1.2.0
 
-FROM dockerfile/java
+FROM registry.codemate.se/java:1.0.0
 MAINTAINER Erik Hedenström <erik@codemate.se>
 
-# Set the env variables to non-interactive
-ENV DEBIAN_FRONTEND noninteractive
-ENV DEBIAN_PRIORITY critical
-ENV DEBCONF_NOWARNINGS yes
-
-# Set Timezone
-RUN \
-  echo "Europe/Stockholm" > /etc/timezone && \
-  dpkg-reconfigure -f noninteractive tzdata
-
-# Fix locale
-RUN \
-  locale-gen en_US.UTF-8 && \
-  echo "LANG=\"en_US.UTF-8\"" > /etc/default/locale && \
-  echo "LANGUAGE=\"en_US.UTF8\"" >> /etc/default/locale && \
-  echo "LC_ALL=\"en_US.UTF8\"" >> /etc/default/locale
-
-# Import self-signed cert as trusted CA
-RUN \
-  openssl s_client -servername cert.codemate.se -connect codemate.se:443 </dev/null | sed -ne '/--BEGIN CERTIFICATE--/,/--END CERTIFICATE--/p' > /tmp/codemate.cert && \
-  keytool -import -noprompt -trustcacerts -keystore /usr/lib/jvm/java-7-oracle/jre/lib/security/cacerts -storepass changeit -noprompt -alias codemate-self-signed -file /tmp/codemate.cert
-
 # Install OpenSSH Server
 RUN \
-  apt-get install -y openssh-server && \
+  apt-fast install -y openssh-server && \
   mkdir -p /var/run/sshd
 
 # Run install scripts
 ENV JENKINS_HOME /var/lib/jenkins
 ADD install /tmp/install
-RUN for INSTALLER in `ls /tmp/install/*.sh | sort -n`; do /bin/bash $INSTALLER; done && rm -rf /tmp/install
+RUN for INSTALLER in `ls /tmp/install/*.sh | sort -n`; do echo "<< Running $INSTALLER >>"; /bin/bash $INSTALLER; done
+RUN rm -rf /tmp/install
 
-# Start SSH Daemon
+# Expose ports and volume
 EXPOSE 22
 VOLUME ["/var/lib/jenkins"]
-CMD ["/usr/sbin/sshd", "-e", "-D"]
+
+# Start SSH Daemon
+ENTRYPOINT ["/usr/sbin/sshd"]
+CMD ["-e", "-D"]
diff --git a/install/00_base.sh b/install/00_base.sh
index c078fce..48cce64 100755
--- a/install/00_base.sh
+++ b/install/00_base.sh
@@ -2,7 +2,5 @@
 
 set -e # Exit on errors
 
-echo "deb http://security.ubuntu.com/ubuntu quantal-security main " >> /etc/apt/sources.list
-
-apt-get update
-apt-get -y upgrade
+apt-fast update
+apt-fast -y upgrade
diff --git a/install/01_jenkins_user.sh b/install/01_jenkins_user.sh
index 6327f32..95cabbd 100755
--- a/install/01_jenkins_user.sh
+++ b/install/01_jenkins_user.sh
@@ -3,7 +3,9 @@
 set -e # Exit on errors
 
 # Create Jenkins user
-useradd -m -d $JENKINS_HOME -s /bin/bash -p $(openssl passwd -1 A4TBYULaVEYstxT7dZLb) jenkins
+mkdir -p $JENKINS_HOME
+useradd -d $JENKINS_HOME -s /bin/bash -p $(openssl passwd -1 A4TBYULaVEYstxT7dZLb) jenkins
+chown -R jenkins:jenkins $JENKINS_HOME
 su - jenkins -c 'git config --global user.email "jenkins@codemate.se"'
 su - jenkins -c 'git config --global user.name "Jenkins"'
 echo "jenkins   ALL=(ALL)   ALL" > /etc/sudoers.d/jenkins
diff --git a/install/10_build_essential.sh b/install/10_build_essential.sh
index 2f3df39..33b955f 100755
--- a/install/10_build_essential.sh
+++ b/install/10_build_essential.sh
@@ -2,5 +2,4 @@
 
 set -e # Exit on errors
 
-apt-get -y install build-essential checkinstall
-apt-get -y install cvs subversion git-core mercurial
+apt-fast -y install build-essential checkinstall cvs subversion git-core mercurial
diff --git a/install/12_chrome_xvfb.sh b/install/12_chrome_xvfb.sh
index 3143edb..1c94f46 100755
--- a/install/12_chrome_xvfb.sh
+++ b/install/12_chrome_xvfb.sh
@@ -5,8 +5,8 @@ set -e # Exit on errors
 curl -s https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
 echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list
 
-apt-get update
-apt-get -y install x11vnc xvfb fluxbox google-chrome-stable
+apt-fast update
+apt-fast -y install x11vnc xvfb fluxbox google-chrome-stable
 
 LATEST_RELEASE=`curl -s http://chromedriver.storage.googleapis.com/LATEST_RELEASE`
 
diff --git a/install/20_ant.sh b/install/20_ant.sh
index e4d8996..3d9bf91 100755
--- a/install/20_ant.sh
+++ b/install/20_ant.sh
@@ -4,9 +4,9 @@ set -e # Exit on errors
 
 cd $JENKINS_HOME/tools
 
-curl -s http://apache.mirrors.spacedump.net/ant/binaries/apache-ant-1.9.3-bin.tar.gz | tar xzf -
+curl -s http://apache.mirrors.spacedump.net/ant/binaries/apache-ant-1.9.4-bin.tar.gz | tar xzf -
 
-ANT_HOME=$JENKINS_HOME/tools/apache-ant-1.9.3
+ANT_HOME=$JENKINS_HOME/tools/apache-ant-1.9.4
 echo "export ANT_HOME=$ANT_HOME" > /etc/profile.d/ant.sh
 echo "export PATH=$ANT_HOME/bin:\$PATH" >> /etc/profile.d/ant.sh
 chmod 755 /etc/profile.d/ant.sh
diff --git a/install/21_maven.sh b/install/21_maven.sh
index 1967a3a..e766ffd 100755
--- a/install/21_maven.sh
+++ b/install/21_maven.sh
@@ -4,12 +4,12 @@ set -e # Exit on errors
 
 cd $JENKINS_HOME/tools
 
-curl -s http://apache.mirrors.spacedump.net/maven/maven-3/3.2.1/binaries/apache-maven-3.2.1-bin.tar.gz | tar xzf -
+curl -s http://apache.mirrors.spacedump.net/maven/maven-3/3.2.3/binaries/apache-maven-3.2.3-bin.tar.gz | tar xzf -
 
 mkdir -p $JENKINS_HOME/.m2
 cp ${0%/*}/maven/settings.xml $JENKINS_HOME/.m2/settings.xml
 
-MAVEN_HOME=$JENKINS_HOME/tools/apache-maven-3.2.1
+MAVEN_HOME=$JENKINS_HOME/tools/apache-maven-3.2.3
 echo "export MAVEN_HOME=$MAVEN_HOME" > /etc/profile.d/maven.sh
 echo "export PATH=$MAVEN_HOME/bin:\$PATH" >> /etc/profile.d/maven.sh
 chmod 755 /etc/profile.d/maven.sh
diff --git a/install/22_gradle.sh b/install/22_gradle.sh
index 9e8a955..da93f2e 100644
--- a/install/22_gradle.sh
+++ b/install/22_gradle.sh
@@ -4,11 +4,11 @@ set -e # Exit on errors
 
 cd $JENKINS_HOME/tools
 
-curl -s -L http://services.gradle.org/distributions/gradle-1.11-bin.zip -o gradle-1.11-bin.zip
-unzip gradle-1.11-bin.zip
-rm -f gradle-1.11-bin.zip
+curl -s -L http://services.gradle.org/distributions/gradle-2.0-bin.zip -o gradle-2.0-bin.zip
+unzip gradle-2.0-bin.zip
+rm -f gradle-2.0-bin.zip
 
-GRADLE_HOME=$JENKINS_HOME/tools/gradle-1.11
+GRADLE_HOME=$JENKINS_HOME/tools/gradle-2.0
 echo "export GRADLE_HOME=$GRADLE_HOME" > /etc/profile.d/gradle.sh
 echo "export PATH=$GRADLE_HOME/bin:\$PATH" >> /etc/profile.d/gradle.sh
 chmod 755 /etc/profile.d/gradle.sh
diff --git a/install/30_android.sh b/install/30_android.sh
index a40fbca..0944fb7 100755
--- a/install/30_android.sh
+++ b/install/30_android.sh
@@ -4,15 +4,15 @@ set -e # Exit on errors
 
 cd $JENKINS_HOME/tools
 
-apt-get -y install libc6-i386 lib32stdc++6 lib32gcc1 lib32tinfo5 lib32ncurses5 lib32z1
+apt-fast -y install libc6-i386 lib32stdc++6 lib32gcc1 lib32tinfo5 lib32ncurses5 lib32z1
 
-curl -s http://dl.google.com/android/android-sdk_r22.6-linux.tgz | tar xzf -
+curl -s http://dl.google.com/android/android-sdk_r23.0.2-linux.tgz | tar xzf -
 
 ( sleep 10 && while :
 do
   echo 'y'
   sleep 2
-done ) | android-sdk-linux/tools/android update sdk -u -t platform-tools,build-tools-19.1.0,android-16,extra-android-support
+done ) | android-sdk-linux/tools/android update sdk -u -t 1,2,android-16,extra-android-support
 
 ANDROID_HOME=$JENKINS_HOME/tools/android-sdk-linux
 echo "export ANDROID_HOME=$ANDROID_HOME" > /etc/profile.d/android.sh
diff --git a/install/40_erlang.sh b/install/40_erlang.sh
index 7aef69c..49721ce 100755
--- a/install/40_erlang.sh
+++ b/install/40_erlang.sh
@@ -2,22 +2,15 @@
 
 set -e # Exit on errors
 
-cd $JENKINS_HOME/tools
+curl -s http://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | apt-key add -
+echo "deb http://packages.erlang-solutions.com/ubuntu $(lsb_release -cs) contrib" > /etc/apt/sources.list.d/erlang-solutions.list
+apt-fast update
+apt-fast -y install erlang erlang-base-hipe
 
-apt-get -y install libncurses5-dev openssl libssl-dev fop xsltproc unixodbc-dev libwxbase2.8 libwxgtk2.8-dev libqt4-opengl-dev
-
-curl -s http://www.erlang.org/download/otp_src_R16B03-1.tar.gz | tar xzf -
-cd otp_src_R16B03-1
-
-./configure --prefix=$JENKINS_HOME/tools/erlang/R16B03 && make && make install
-
-cd $JENKINS_HOME/tools
-
-rm -rf otp_src_R16B03-1
-
-ERL_TOP=$JENKINS_HOME/tools/erlang/R16B03
+ERL_TOP=/usr/lib/erlang
 echo "export ERL_TOP=$ERL_TOP" > /etc/profile.d/erlang.sh
 echo "export PATH=$ERL_TOP/bin:\$PATH" >> /etc/profile.d/erlang.sh
 chmod 755 /etc/profile.d/erlang.sh
+
 echo "TZQPJJRMMVKMHAWMVPMB" > $JENKINS_HOME/.erlang.cookie
 chown -R jenkins:jenkins $JENKINS_HOME/.erlang.cookie
diff --git a/install/50_nodejs.sh b/install/50_nodejs.sh
new file mode 100644
index 0000000..ed5cd52
--- /dev/null
+++ b/install/50_nodejs.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+set -e # Exit on errors
+
+apt-fast -y install nodejs npm
diff --git a/install/60_golang.sh b/install/60_golang.sh
new file mode 100644
index 0000000..410bfd7
--- /dev/null
+++ b/install/60_golang.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+set -e # Exit on errors
+
+apt-fast -y install golang
diff --git a/install/99_cleanup.sh b/install/99_cleanup.sh
index 2618043..717b02e 100755
--- a/install/99_cleanup.sh
+++ b/install/99_cleanup.sh
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 
-set -e # Exit on errors
-
 chown -R jenkins:jenkins $JENKINS_HOME
 
-apt-get autoclean
-apt-get clean
-apt-get autoremove
+apt-fast autoclean
+apt-fast clean
+apt-fast autoremove
+
+exit 0
diff --git a/install/maven/settings.xml b/install/maven/settings.xml
index 82edaf4..5f68c4a 100644
--- a/install/maven/settings.xml
+++ b/install/maven/settings.xml
@@ -1,17 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <settings>
 
-	<mirrors>
-		<mirror>
-			<id>Nexus</id>
-			<name>Nexus Public Mirror</name>
-			<url>http://nexus:8081/nexus/content/groups/public</url>
-			<mirrorOf>central</mirrorOf>
-		</mirror>
-	</mirrors>
-
 	<pluginGroups>
 		<pluginGroup>com.atlassian.maven.plugins</pluginGroup>
 	</pluginGroups>
 
-</settings>
\ No newline at end of file
+</settings>
-- 
GitLab