Jenkins is a great CI System to run your tests and also do deployments. There are a lot of awesome Plugins and it is possible to do almost anything with it.
Docker is great beacuse you can create isolated environments, which is awesome for testing! No more: “It worked on my machine” excuses…
I was facing the problem to run some Ember Frontend Tests with Jenkins. But instead of installing nodejs, npm and so on on the Jenkins (master) directly, I decided to run it inside a docker container, because that’s how we run everything on our server now at work! The Docker Container does not even need to run on the same machine, because Jenkins can connect via SSH to any host and automatlically install itself on that machine. So let’s get started:
I prepared a Docker Image with Java, Nodejs, Bower, ember-cli: docker-ember-ci
Jenkins can log in with the user
docker. In order to do that, you have to put the public ssh key in a
authorized_keys file and mount that into the docker container.
In Jenkins go to
Manage Jenkins ->
Nodes and add another
Dumb Slave. Select Unix SSH and use the ssh keypair with the public key in the already mounted
authorized_keys file. Use
/home/docker as directory for Jenkins. Be sure to use the username
docker. Jenkins can now connect to the new node and automatically installs itself onto it.