# My First DevOps Project: Dockerizing a Mario Game on Azure VM 🚀🎮

### **DevOps has always fascinated me** —the way development and operations come together to deliver software faster and more efficiently. As a student exploring the world of DevOps, I wanted to get hands-on and try something end-to-end.

That’s how I started my very first DevOps project: **taking a Node.js Mario Game application, running it on an Azure Virtual Machine, and Dockerizing it for optimized deployment.**

This blog is my complete journey — from setting up the VM to serving Mario in the browser!

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1757771163658/e52aa071-9f54-4ed8-8ef3-d05bcd679c79.png align="center")

## 🖥️ Step 1: Setting Up My Azure VM

The first step was to spin up an Ubuntu VM in **Microsoft Azure**. After creating the VM from the portal, I connected to it securely using SSH:

```plaintext
ssh -i dockerdemo_key.pem azureuser@<VM-IP>
```

Once inside, I felt like I was really “in the cloud.” 🌩️

## 🐳 Step 2: Installing Docker

Next, I installed Docker on my VM. This part wasn’t smooth at first — I mistakenly followed Debian instructions on Ubuntu and ran into repo errors. After fixing that, Docker installed successfully, and I could check the version:

```plaintext
docker --version
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1757770661927/d6f68d3c-3f64-4a62-b1f8-d63ce5633cb9.png align="center")

This was the moment it started feeling real: I had Docker running inside my own cloud VM!

## 🎮 Step 3: Cloning the Mario Game Project

For this project, I used a **Mario Game Node.js app** available on GitHub. I cloned the repository into my VM and prepared to containerize it.

## 🐳 Step 4: Writing the Dockerfile

Here comes the heart of the project.  
I wanted to follow DevOps best practices, so instead of a single-stage Dockerfile, I wrote a **multi-stage Dockerfile** inside a `devops/` folder.

Here’s the final Dockerfile I created:

```plaintext
# build stage
FROM node:18-alpine AS build

WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

# deploy stage
FROM node:18-alpine

WORKDIR /app
COPY --from=build /app/dist ./dist
RUN npm install -g http-server

EXPOSE 8080
CMD ["http-server","dist","-p","8080","-c-1"]
```

### Why Multi-Stage Builds?

* Stage 1 → Install dependencies + build app.
    
* Stage 2 → Copy only necessary build artifacts, not dev dependencies.
    
* Result → **Much smaller image size** and faster deployments.
    

This was a big learning moment for me: how DevOps engineers optimize Docker images.

## ⚡ Step 5: Building & Running the Container

I built the Docker image with:

```plaintext
sudo docker build -t mario-game .
```

Then I ran it on port **8080**:

```plaintext
sudo docker run -d -p 8080:8080 mario-game
```

Checking with `docker ps` confirmed the container was live.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1757770848019/c85981aa-ecbb-4a0f-85ca-ae332e4bc96f.png align="center")

## 🌐 Step 6: Playing Mario in the Browser

Finally, I opened my VM’s IP in the browser on port **8080** — and there it was: **Super Mario running from my Docker container on Azure!** 🎉

👉 *Screenshots of Mario in browser here*

This was the most exciting part of the whole project — seeing everything come together.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1757770894488/c7bc96c5-9be3-4427-89e9-ba8a119cc081.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1757770950443/ed995316-a46f-4a28-9728-098bc5c53f7a.png align="center")

## 💡 Key Learnings

This project taught me so much about real-world DevOps:

* **SSH into Cloud VMs** → setting up and accessing Azure machines securely.
    
* **Installing and managing Docker** inside a cloud VM.
    
* **Multi-stage Docker builds** → separating build and production stages.
    
* **Reduced Docker image size** → by using `node:18-alpine` (lightweight base image) and copying only the final build (`/dist`) instead of the entire source code. This cut down the image size significantly, making it faster to build, push, and run.
    
* **Port mapping** → exposing containerized apps to the outside world.
    

## 🎯 Conclusion

This was my **first DevOps project**, and it gave me real confidence in working with Docker and cloud VMs. I learned not just how to containerize an app, but also how to think like a DevOps engineer — optimizing, troubleshooting, and deploying in the cloud.

## 🙌 Let’s Connect!

If you enjoyed this post or have suggestions, feel free to drop a comment.  
You can also connect with me on [https://www.linkedin.com/in/santosh-reddy-95a342283](https://www.linkedin.com/in/santosh-reddy-95a342283).

Let’s keep learning and growing in DevOps together! 💡
