Containerizing the deployment units with Docker
The three deployment options we will be studying in the final three chapters of this book are Google Kubernetes Engine, Google App Engine (Flexible), and Google Cloud Run. All these options are container-based, so we need to understand how to define a Docker image, how to build that image, and how to push it into a container registry.
We will begin by examining how we do this for our front-end project. The following source will be placed in a file called Dockerfile
, at the root of our frontend project:
FROM NGINX:1.17.10-alpine COPY WebContent /usr/share/NGINX/html EXPOSE 80
The preceding code starts by declaring our image. This will build on top of the NGINX version 1.17.10-alpine image, which can be found in the Docker registry. We then copy our web content into the directory NGINX uses to serve web content, specifically /usr/share/NGINX/html
. We finish by declaring that the container will expose a service on port 80
.
It...