Building and Deploying a Dockerized Full-Stack Application on Azure with GitHub Actions CI/CD

As part of my 90-project Cloud Engineering journey, I completed Project 4/90: containerizing and deploying a full-stack application using Docker, Docker Compose, Microsoft Azure, and GitHub Actions.

For this project, I used FlowPilot, a task and project management application, to explore how multi-container applications are deployed and managed in a cloud environment.

🏗️ Project Architecture

The application consists of three main services:

  • Web: React frontend served through Nginx.
  • API: Node.js and Express backend.
  • Database: MongoDB for persistent data storage.

Docker Compose manages all three services and creates an internal network for communication.

🛠️ Technologies Used

  • React and Vite
  • Node.js and Express
  • MongoDB and Mongoose
  • Docker
  • Docker Compose
  • Nginx
  • Microsoft Azure Linux VM
  • GitHub Actions
  • SSH

🐳 Containerization with Docker

I created Docker configurations for the frontend and backend and used Docker Compose to manage the complete application.

The following command builds and starts the services:

docker compose up -d --build 

To check the running containers:

docker compose ps 

All three services were successfully running.

Docker Containers

🌐 Docker Networking

Docker Compose automatically creates a network that allows containers to communicate using service names.

The backend connects to MongoDB using the internal hostname mongo.

Nginx serves the frontend and reverse-proxies API requests to the backend.

Only port 80 is exposed publicly. MongoDB and the backend API remain accessible through internal container networking.

Docker Architecture

☁️ Deployment on Microsoft Azure

I provisioned an Ubuntu Server 24.04 Linux Virtual Machine on Microsoft Azure.

After installing Docker and Docker Compose, I cloned the application repository onto the VM and configured the required environment variables.

The application was then built and started using Docker Compose.

The deployed application was accessible through the VM's public IP.

Azure Dashboard

⚙️ CI/CD with GitHub Actions

One of the most important parts of this project was implementing automated deployment.

I configured a GitHub Actions workflow that triggers whenever code is pushed to the main branch.

The workflow:

  1. Connects to the Azure VM using SSH.
  2. Navigates to the application directory.
  3. Pulls the latest changes from GitHub.
  4. Rebuilds and restarts Docker Compose services.
  5. Checks the running containers.

I configured GitHub repository secrets for the VM host, username, and private SSH key.

After resolving an SSH private key configuration issue, the workflow completed successfully.

Successful GitHub Actions Pipeline

🧪 Testing the Application

I verified the deployed application by logging in and creating tasks through the web interface.

This confirmed that the frontend, backend API, and MongoDB database were communicating correctly.

Application Dashboard

📚 What I Learned

This project gave me hands-on experience with:

  • Dockerfiles and containerization.
  • Multi-container application architecture.
  • Docker networking and persistent volumes.
  • Deploying applications on Azure Linux VMs.
  • SSH-based remote deployment.
  • GitHub Actions CI/CD.
  • Managing environment variables and deployment secrets.

🔮 What's Next?

There are several improvements I would like to explore in future projects:

  • HTTPS using SSL/TLS.
  • Automated testing in CI/CD.
  • Centralized logging and monitoring.
  • Automated database backups.
  • Improved deployment security.

🔗 Project Links

Application Source Code: https://github.com/saadshah2033-cyber/FlowPilot

Live Application: http://20.219.134.32

Note: The Azure VM may be deallocated when not in use, so the live application might not always be accessible.

This is Project 4/90 in my Cloud Engineering journey.

86 more projects to go. Keep