Bamboo is a strong tool for implementing a stable continuous integration and deployment pipeline which is an essential part of the DevOps process. This topic is greatly explained in a recent blog post by Ian Buchanan published in the Atlassian Developer blog.
Docker describes itself as “An open platform for distributed applications for developers and sysadmins” and has rapidly gained popularity as one of the best tools to build, ship, and run software. Use of Docker allows replicating the exact environment of the builds locally. It also makes it possible to run deployments against different environments (i.e. QA or production) consistently.
Recent Bamboo releases have been using Docker very effectively for a variety of use cases, from provisioning Bamboo agents in Docker to providing tasks for building Docker images, pushing images to a Docker registry, and running Docker containers.
This post will go over a practical use case scenario that combines the power of Docker containers with Bamboo’s strong Docker features for building and deploying a web application — just one of the many ways the Bamboo Docker duo works together!
Two Docker containers to begin with
The goal here, as mentioned above, is building a web application. We’ll walk you through making a simple Node.js web app that uses Redis to maintain a counter for the number of times a page is visited. Every time the page is refreshed, the counter gets automatically incremented:
We’ll be using two Docker containers: One for Redis and one for the Node.js web app. The two containers will be able to communicate with each other once we utilize Docker’s linking ability.
You can find the source code of the app here: https://bitbucket.org/addteq/bamboo-docker-example/src. This repository contains a Dockerfile with all the steps you need to take for creating the web app’s Docker image: