This is a simple Maven project that:
- builds a WAR file
- deploys the WAR file to a docker image
- implements a simple Jenkins DSL Release Flow.
- Download and Install Vagrant.
- Download and install VirtualBox.
- Start a Vagrant box with Docker. For example: williamyeh/ubuntu-trusty64-docker.
vagrant init williamyeh/ubuntu-trusty64-docker
vagrant up
3.1 If required add configuration to the Docker service at: /etc/default/docker
3.2 Configure the "Port Forwarding" on the running VM in VirtualBox to expose the required ports for the Docker containers you would launch.
-
Install Jenkins on the VM
-
Add user jenkins to the docker group:
usermod -G docker jenkins
- Install JDK 8 (Optional: Configure in Jenkins)
apt-get install software-properties-common python-software-properties
add-apt-repository ppa:openjdk-r/ppa
apt-get update
apt-get install openjdk-8-jdk
There is a nasty bug installing JAVA on Ubuntu 14.04. The fix is simple:
apt-get install --reinstall ca-certificates-java
update-ca-certificates -f
- Install Maven (Optional: configure in Jenkins)
sudo apt-get purge maven maven2 maven3
sudo apt-add-repository ppa:andrei-pozolotin/maven3
sudo apt-get update
sudo apt-get install maven3
- Advanced SSH Configuration (In case you need it)
- Initialize Jenkins.
- Install the following plugins:
- Job DSL Plugin
- Release Plugin
- Conditional Buildstep
- Maven Release Plug-in
- Create a Jenkins Job DSL project and import a DSL script from the /dsl project directory