Let’s go the Microservices Way: Day 2

Packaging and Preparation for Deployment

Anchit Arnav
3 min readMay 25, 2023

Step 1: Get a basic application Code ready

Before proceeding further, you should pick up the most basic form of your application, and keep it ready.

e.g. if you are developing a Web Application, all you need is a Hello World application with just 1 view setup.

This helps you to go ahead with the deployment-related steps, without getting stuck for completing the Application code.

In an actual development environment, your Application Development team and Operations team can be entirely different, and keeping a small prototype helps unblock both teams to go ahead at their own pace for the necessary first steps, and merge at a later point when some basic structural blocks are in place.

Step 2: Packaging your application as Docker Image

The next step is to package your application so that it’s ready to ship. For this, you need something called a “Dockerfile”.

Dockerfile is nothing but a set of directives that help the Docker runtime to create a docker image for you. You should ask yourself the question “What is the minimum number of things that I have installed on my local machine to get this application running ?”. These are the things that you should consider adding to your Dockerfile on the first attempt.

Details of a Dockerfile are outside the scope of this document, but consider this more of a directive on what you need to research next! Just Google “How to write a Dockerfile”, and you will find tons of resources.

At the end you should find yourself executing a command like:

docker build -t <your_tag> <your_repo_path_on_local>

Step 3: Push your Docker Image to a repository

Just like there are repositories for Code (like Github, Gitlab, etc), there are repositories for Docker Images. They are sometimes referred to as “Artifact Registry” or “Container Registry”.

Dockerhub is a popular Container Registry, which offers a free account as well. All major Cloud Providers have their own registries. Amazon ECR, Azure Container Registry, Google Artifact Registry, etc. are examples.

Which one to pick?

Well, this is where we need to think one step ahead and plan for the best implementation upfront.

If you are working on an open-source project, then using Dockerhub is the easiest and recommended approach.

However, for your private projects, destined to be deployed on the cloud somewhere, I would recommend that you choose the Registry Service offered by the same Cloud Provider that you plan to host your application.

Cloud Providers generally have seamless and secure integration with their own container registry solutions, and the time to pull your images as well gets reduced considerably.

That said, if you have an obligation to choose something else, please push the image to the registry of your choice. There are ways to connect it to any other Kubernetes Cluster.

Please follow the documentation of the platform of choice, or “How to push Container Image to XYZ registry”. In the end, you should find yourself executing something like:

docker push <tag options>

Conclusion

Now you are ready to proceed with the deployment steps.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Anchit Arnav
Anchit Arnav

Written by Anchit Arnav

Cloud Computing and Security Enthusiast. Find out more at https://www.linkedin.com/in/anchitarnav/

No responses yet

Write a response