This repository was created for the workshop and blog https://dev.to/sudo_anuj/automating-flask-app-deployment-with-docker-github-actions-8gh
**Please star this repository **
- Clone the repo
git clone https://github.com/tyagian/cicd_example.git
- Build the Docker image
docker build -t flask-webserver .
- Run the Container
docker run -p 5000:5000 flask-webserver
- Test from browser
Open the Webpage http://localhost:5000
This setup provides a fully functional Flask web server with a responsive homepage, all running inside a Docker container.
- Inside your GitHub repository, create the following directory and file:
.github/workflows/docker-build.yml
-
This workflow automates the build and trigger pipeline whenever you push code to the main branch.
-
Setting Up Secrets in GitHub a. Go to your repository on GitHub. b. Navigate to Settings → Secrets and variables → Actions. c. Click New repository secret and create a secret:
Name:GHCR_TOKENValue:A GitHub Personal Access Token (PAT) with the followingread: packageswrite: packagesdelete: packages -
After the GitHub Action runs successfully, you can pull & run the container using:
docker pull ghcr.io/<your-github-username>/flask-webserver:latest
docker run -p 5000:5000 ghcr.io/<your-github-username>/flask-webserver:latest
-->