What will you learn in this module?
This guide will show you how to create, test, and deploy containerized Go applications using Docker.
We'd like to thank Oliver Frolovsopen_in_new for his contribution to this guide.
In this guide, you’ll learn how to:
- Create a Dockerfile which contains the instructions for building a container image for a program written in Go.
- Run the image as a container in your local Docker instance and manage the container's lifecycle.
- Use multi-stage builds for building small images efficiently while keeping your Dockerfiles easy to read and maintain.
- Use Docker Compose to orchestrate running of multiple related containers together in a development environment.
- Configure a CI/CD pipeline for your application using GitHub Actionsopen_in_new
- Deploy your containerized Go application to Google Cloud Runopen_in_new serverless platform.
Some basic understanding of Go and its toolchain is assumed. This is not a Go tutorial. If you are new to the language, the Go websiteopen_in_new is a great place to explore, so go (pun intended) check it out!
Your Docker set-up must have BuildKit enabled. BuildKit is enabled by default for all users on Docker Desktop. If you have installed Docker Desktop, you don’t have to manually enable BuildKit. If you are running Docker on Linux, please check out BuildKit getting started page.
Some familiarity with the command line is also expected.
The aim of this guide is to provide enough examples and instructions for you to containerize your own Go application and deploy it into the Cloud.
Let's get started!