Create your own CI Docker image for AWS S3 + CloudFront

Create your own CI Docker image for AWS S3 + CloudFront with Node 11 and Yarn

Thato Nwamadi
March 1, 2023
Blog cover image

Create your own CI Docker image for AWS S3 + CloudFront with Node 11 and Yarn

Finding the perfect Docker image to use on your CI can be tough — most stock ones don’t come with all the tools you require and custom ones with the right tools are created and controlled by people you don’t know. Luckily creating your own image is easy and can be done in a few minutes — let’s look at how.

  1. load and install Docker Desktop if you haven’t already. Links to the apps can be found on their getting started page.
  2. Create a Docker account — you will need this to upload your image to the Docker Hub.
  3. Find a suitable starting image — in our case we went with node:11.9.0-alpine

Note that for now we only need to know the name of the image that we want. The Node image tags can be found on the Node page on Docker Hub.

This image was chosen because it is official and at the time of writing Node 11.9.0 was the latest available version of Node. The Alpine Linux variant was chosen because it is lightweight.

4. Create a file called “Dockerfile” with the following content:

  1. In your terminal rundocker build . -t your_docker_user/your_image_name

docker build . -t your_docker_user/your_image_name

Your Docker image should build now. The -t is to tag your image — this is how we will reference it later in our CI. After the image has built running docker images should show you a list of images, including the base image and the one we just built.

  1. Publish the image to Docker Hub by running

docker push your_docker_user/your_image_name

  1. Make use of the image in your CI

For example in Bitbucket Pipelines set the first line of your bitbucket-pipelines.yml file to image: your_docker_user/your_image_name.

As seen on FOX, Digital journal, NCN, Market Watch, Bezinga and more