Building and pushing images with Docker
Introduction
Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly.
With Docker, you manage your infrastructure in the same way you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you significantly reduce the delay between writing code and running in production.
Build and Push Online Boutique Application Images
In this section you will build and push to DOCR all required images for the online boutique demo project using docker CLI. A helper script is used to ease the process, named make-docker-images.sh.
Follow below steps to build and push online boutique demo application images using docker
CLI:
-
Clone your
microservices-demo
repository if you haven't already (make sure to replace the<>
placeholders first): -
From the command line, change directory to the
microservices-demo
folder (if not there already): -
Login to DOCR:
-
Run the
make-docker-images.sh
script after setting required environment variables first:export REPO_PREFIX="registry.digitalocean.com/microservices-demo" export TAG="v1.0.0" ./release-scripts/make-docker-images.sh
Info
This script will go through each of the microservices and perform a
docker build
and adocker push
tagging each image with the service name and theTAG
environment variable exported above. You will be pushing an initial release first to DOCR -v1.0.0
, and use that to deploy to thestaging
andproduction
environments in the upcoming sections. Later on, GitHub Actions will take care of building, tagging and pushing images toDOCR
.
Next, you have the option to study Cloud Native Buildpacks project to build and push docker images without having to write a single Dockerfile.
If not, skip to the Development Environment section where you will learn how to setup DOKS and deploy the microservices-demo
application to your development environment, as well as configuring ingress
and monitoring
.