This repo is a minimal assignment-ready scaffold that includes:
docker-compose.yml— runs a MySQL (db) and a Flask app (web) on the same network.web/— Flask app,Dockerfile,requirements.txt.mysql/conf.d/my.cnf— small MySQL config to avoid the pid-file advisory.Jenkinsfile— minimal pipeline to build, smoke-test, and push the image to Docker Hub.
Run locally
- Build and start both services:
docker-compose up --build- Verify:
- Open http://localhost:5000 — the Flask app will report whether it connected to MySQL.
- Confirm both containers are on the same network:
docker-compose ps
docker network ls
docker network inspect app-networkCI/CD (GitHub + Jenkins) — essentials
- Push this repo to GitHub.
- Create a Jenkins Pipeline job that uses this repo (or use a multibranch pipeline).
- Add Docker Hub credentials to Jenkins and set the credentials id used in the
Jenkinsfile(dockerhub-credsby default). - Ensure the Jenkins agent can run Docker CLI (no local MySQL required on Jenkins).
Notes
- Replace
yourdockerhubusername/flask-appinJenkinsfilewith your Docker Hub repo name. - The MySQL env vars in
docker-compose.ymlare:MYSQL_ROOT_PASSWORD,MYSQL_DATABASE(appdb),MYSQL_USER(appuser),MYSQL_PASSWORD(apppassword). - The MySQL advisory you saw is informational;
mysql/conf.d/my.cnfhas been added to avoid it.
If you want, I can:
- Replace placeholders in
Jenkinsfilewith your Docker Hub repo and credentials id. - Add a simple unit test and a pipeline test stage.