From Flask App to CI/CD Pipeline with GitHub Actions & Docker Hub

DevOps is all about bridging development and operations. For this project, I decided to get hands on by containerizing a simple web application and automating its deployment pipeline. Here’s how I built a complete CI/CD workflow from scratch using Python + Flask for the web app Docker for containerization GitHub for version control GitHub Actions for CI/CD Docker Hub for image hosting ✅ Step 1: Create a Simple Flask Application 1.1 Set up a project folder 1.2 Create a virtual environment and install Flask 1.3 Create your Flask app Create a file called app.py and paste this in: 1.4 Run the app locally Then open your browser and go to http://localhost:5000 ✅ Step 2: Containerize the Application 2.1 Create a Dockerfile Create a file called Dockerfile (no extension) in the root folder: 2.2 Create .dockerignore Create a file named .dockerignore: 2.3 Build the Docker image 2.4 Run the container Open http://localhost:5000 in your browser again. You should see Hello DevOps! ✅ Step 3: Set Up Version Control Next, I pushed the project to GitHub to manage changes and integrate CI/CD workflows. git init git add . git commit -m "Run" git remote add origin https://github.com/adeleke123/flask-devops-app.git git push -u origin main

Apr 13, 2025 - 12:26
 0
From Flask App to CI/CD Pipeline with GitHub Actions & Docker Hub

DevOps is all about bridging development and operations. For this project, I decided to get hands on by containerizing a simple web application and automating its deployment pipeline.

Here’s how I built a complete CI/CD workflow from scratch using

  • Python + Flask for the web app
  • Docker for containerization
  • GitHub for version control
  • GitHub Actions for CI/CD
  • Docker Hub for image hosting

✅ Step 1: Create a Simple Flask Application

1.1 Set up a project folder

setup

1.2 Create a virtual environment and install Flask

venv

1.3 Create your Flask app

Create a file called app.py and paste this in:

app

1.4 Run the app locally

Host
Then open your browser and go to http://localhost:5000

✅ Step 2: Containerize the Application

2.1 Create a Dockerfile
Create a file called Dockerfile (no extension) in the root folder:

Dockerfile

2.2 Create .dockerignore
Create a file named .dockerignore:

Dockerignore

2.3 Build the Docker image

Build

2.4 Run the container

Host

Open http://localhost:5000 in your browser again. You should see Hello DevOps!

Browser

✅ Step 3: Set Up Version Control

Next, I pushed the project to GitHub to manage changes and integrate CI/CD workflows.

git init
git add .
git commit -m "Run"
git remote add origin https://github.com/adeleke123/flask-devops-app.git
git push -u origin main

Hub

git