1. Putting It On GitHub
We have 2 Spring projects, so we are making 2 separate repositories, one for each microservice.
2. Setting Up Codespaces
GitHub Codespaces provides an isolated cloud environment where you can build and test your Docker images without cluttering your local machine.
3. Converting To JAR File
Before we can containerize our Spring Boot application, we must compile it into an executable JAR file.
4. Creating Dockerfile
A Dockerfile is a script that contains a collection of instructions for building your Docker image. It specifies the base OS, Java runtime, and how to execute your application.
4.1. Understanding Dockerfile Commands
This is an optional chapter designed to help you deeply understand what each line in the Dockerfile accomplishes.
5. Creating DockerHub Account & Repo
DockerHub is a cloud registry where you can safely store and share your built Docker images.
6. Building Docker Image
Now that you have created a Docker account and a repository using Creating DockerHub Account & Repo, we will physically build the image.
6.1. Testing Docker Image Locally
This is an optional step that can only be performed after you have successfully built the image using Building Docker Image.
7. Logging In To DockerHub
We have created a Docker repository and we have a built Docker image on our system, but we have not securely connected the two environments yet.
8. Pushing Docker Image To DockerHub
This is the final step where we upload our locally built container image to the cloud repository.