Learn how to create your own CI Docker image for AWS S3 + CloudFront with Node 11 and Yarn, backed by SOFTWARE DEVELOPMENT SERVICES for seamless deployment.
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.
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.
Create a file called “Dockerfile” with the following content:
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.
docker push your_docker_user/your_image_name
For example, in Bitbucket Pipelines, set the first line of your bitbucket-pipelines.yml file to image: your_docker_user/your_image_name.