How to make Jenkins build NodeJS, Ruby, and Maven on Docker

How To Make Jenkins Build #NodeJS, #Ruby, And #Maven On #Docker  #reactjs #devops

  • I add yarn, gulp, grunt, bower, and sass to our build.
  • Two of the greatest weapons we use to slice overhead to confetti are Jenkins and Docker.
  • How to make Jenkins build NodeJS, Ruby, and Maven on Docker
  • Jenkins can speed up repetitive tasks that robots are much better performing and Docker simplifies spinning up VM’s for your application in a very simple and repeatable way.
  • What I’m going to cover is how to setup your Jenkins server in a Docker container and how to fix some of the limits of the Jenkins official image.

Setup your Jenkins server in a Docker container and fix some of the limits of the official image I discovered so you can get up and building faster.

@K0YCHEV: How To Make Jenkins Build #NodeJS, #Ruby, And #Maven On #Docker #reactjs #devops

30 January 2017 on docker, nodejs, jenkins, ci

TL;DR see the final GitHub repo

I thought I’d share with you how we are increasing our productivity here at Quantum Mob. When you are a small team you have to do more with less. Two of the greatest weapons we use to slice overhead to confetti are Jenkins and Docker. Jenkins can speed up repetitive tasks that robots are much better performing and Docker simplifies spinning up VM’s for your application in a very simple and repeatable way. What I’m going to cover here is how to setup your Jenkins server in a Docker container and how to fix some of the limits of the Jenkins official image. Let’s get you up and building faster. Don’t worry, before I get into the thick of it I’ll provide a little background about Docker & Jenkins for those that haven’t had much chance to play with them.

Docker is the most popular containerization platform. Containerization helps by describing everything need to get an app running. OS binaries, all the software dependencies you need to install, environment variables… absolutely everything. Think a lighter virtual machine on steroids with your application pre-installed. No more head scratching wondering why it runs perfectly on your machine but not in DEV. No more hours of debugging only to discover the version of node or java are different locally. You build it and it runs the same everytime, everywhere.

Here is how Docker describes itself:

. And docker has a massive marketplace for open source containers called Docker Hub. Some of the most popular containers are Nginx, Redis, MySQL, Mongo and Elasticsearch, but the one that caught my eye was Jenkins.

Jenkins is a continuous integration server. It is very flexible and can perform quite a few tricks right out of the box. It offers webhooks that github, bitbucket, and others can call when you push your code which saves a lot of time. It ensures your unit tests are executed everytime and can refresh your server with the compiled code if it builds successfully.

While it is nice of Jenkins to offer an official docker image, you’ll quickly run into a few issues if you are doing anything even slightly other than compiling plain Java. For instance, Maven, the popular dependency management tool for Java, is not included in the Docker container. If you want to work with Ruby or NodeJS you’ll notice those are missing as well. Let’s make our Jenkins build a little more robust.

you’ll see this line:

Because we work with Java, JavaScript, and NodeJS at Quantum Mob, here is my modified file:

access available in our shell scripts incase we need it. It also adds Maven, Ruby and a couple other tools that will become useful. If you are using something else like Python or Go, this would be where you would add it.

Now we’re going to add NodeJS to our container, based on node.docker.

Setting up NodeJS was certainly more verbose, but it handles downloading the tar as well as ensuring all the correct configurations have been made. Now we’re all set with NodeJS and NPM.

Lastly, I add yarn, gulp, grunt, bower, and sass to our build. This will allow the most common NodeJS libraries to be present when we are building our projects.

You’ve learned to create a Jenkins Docker-container that’s ready to run jobs for Java, Ruby and NodeJS projects. Next time I’ll cover how we automated all projects to use this version of Jenkins, which allows us to set up new projects across environments and hop on development in minutes.

How to make Jenkins build NodeJS, Ruby, and Maven on Docker