Created
August 27, 2014 07:27
-
-
Save tank-bohr/efbb49eba624117ed05d to your computer and use it in GitHub Desktop.
Jenkins slave Docker/Vagrant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:latest | |
MAINTAINER Alexey Niktin <niktin@corp.sputnik.ru> | |
# RUN echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" > /etc/apt/sources.list | |
ADD provisioning.sh /tmp/provisioning.sh | |
RUN bash /tmp/provisioning.sh | |
EXPOSE 22 | |
# Jenkins docker plugin does it himself | |
# CMD ["/usr/sbin/sshd", "-D"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
set -x | |
export DEBIAN_FRONTEND=noninteractive | |
export USE_ORACLE_JDK="true" | |
apt-get update | |
# Useful stuff | |
apt-get install -y git subversion wget openssh-server cowsay | |
# Ruby build dependencies | |
# See https://github.com/wayneeseguin/rvm/blob/master/scripts/functions/requirements/ubuntu | |
apt-get install -y \ | |
g++ gcc make libc6-dev patch openssl ca-certificates libreadline6 \ | |
libreadline6-dev curl zlib1g zlib1g-dev libssl-dev libyaml-dev \ | |
libsqlite3-dev sqlite3 autoconf \ | |
libgdbm-dev libncurses5-dev automake libtool bison pkg-config libffi-dev | |
# Erlang | |
apt-get install -y erlang-base | |
# Install java | |
if [ -n $USE_ORACLE_JDK ]; then | |
apt-get install -y software-properties-common python-software-properties | |
add-apt-repository ppa:webupd8team/java -y | |
apt-get update | |
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections | |
apt-get -y install oracle-java7-installer | |
else | |
apt-get install -y --no-install-recommends openjdk-7-jdk | |
fi | |
# Build ruby | |
cd /tmp | |
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz | |
tar xzf ruby-2.1.2.tar.gz | |
cd /tmp/ruby-2.1.2 | |
./configure --disable-install-doc --prefix=/opt/ruby | |
make install | |
# Install ansible | |
apt-get install -y python-setuptools python-dev | |
git clone https://github.com/ansible/ansible.git /opt/ansible | |
source /opt/ansible/hacking/env-setup | |
easy_install pip | |
pip install pyyaml jinja2 nose passlib pycrypto | |
# Create jenkins user with password jenkins | |
useradd --create-home --shell /bin/bash --groups root --password `openssl passwd -crypt jenkins` jenkins | |
# Eliminate Message Of The Day | |
rm /etc/update-motd.d/* | |
touch /home/jenkins/.hushlogin | |
mkdir -p /var/run/sshd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "ubuntu/trusty64" | |
config.vm.provision "file", source: "provisioning.sh", destination: "/tmp/provisioning.sh" | |
config.vm.provision "shell", inline: "/bin/bash /tmp/provisioning.sh" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment