Docker Streamlit Application Deployment Using GitHub Actions on AWS Self-Hosted Runner
This project demonstrates a CI/CD pipeline using GitHub Actions to build a Dockerized Streamlit Python application and deploy it to an AWS EC2 Self Hosted Runner.
Github Repo link๐Docker Deployment using Github Actions
Project Workflow :
Code Commit: Developers push code changes to the
main
branch.CI Build Job: GitHub Actions triggers a build job (
build.yml
) upon code commit.Docker Image Build: The CI job builds a Docker image from the Dockerfile and pushes it to Docker Hub upon successful build.
CD Deploy Job: After the image is pushed, another GitHub Actions job (
deploy.yml
) is triggered.Deployment to AWS EC2:
The deploy job uses a self-hosted runner on an AWS EC2 instance.
It pulls the latest Docker image from Docker Hub.
The image is then run as a container on the EC2 instance.
Repository Structure:
.github/workflows/
: Contains GitHub Actions workflows.build.yml
: Defines CI build steps.deploy.yml
: Defines CD deployment steps.
Dockerfile
: Configuration for building the Docker image.README.md
: Project documentation (you are currently reading this file).
Prerequisites:
Before running the CI/CD pipeline, ensure you have set up the following:
GitHub Repository: Configure secrets for Docker Hub credentials (
DOCKER_USERNAME
,DOCKER_PASSWORD
) as Repo Secrets.Docker Hub Account: Repository for storing Docker images.
AWS EC2 Instance: Ensure the instance is running and accessible via SSH and Configured Self-Hosted Runner
Final Deployment :
Notes
Ensure that your Dockerfile is configured correctly to build and run your Python application.
Regularly monitor and maintain your AWS EC2 instance to ensure proper functioning of the deployed application.
Contributing
Contributions are welcome! If you have suggestions, bug reports, or want to add new features, feel free to submit a pull request.
Feel free to explore, contribute, and adapt this project to suit your needs. If you encounter any issues or have suggestions for improvement, please raise them in the GitHub repository's issues section. Happy coding! ๐
Connect with me on Linkedin: Raghul M
Subscribe to my newsletter
Read articles from Raghul M directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Raghul M
Raghul M
I'm the founder of CareerPod, a Software Quality Engineer at Red Hat, Python Developer, Cloud & DevOps Enthusiast, AI/ML Advocate, and Tech Enthusiast. I enjoy building projects, sharing valuable tips for new programmers, and connecting with the tech community. Check out my blog at Tech Journal.