This project contains a simple web application using Flask with a MySQL database and phpMyAdmin interface, all managed via Docker Compose.
Clone the repository:
git clone https://github.com/anhquanbui/myapp.git
cd myapp
Create an .env
file in the project root with your secrets:
MYSQL_ROOT_PASSWORD=RootPass123!
MYSQL_DATABASE=mydb
MYSQL_USER=appuser
MYSQL_PASSWORD=AppPass123!
APP_USER=admin
APP_PASSWORD=superStrongPass123
Build and start all services:
docker compose up -d --build
- Flask app → http://localhost:5000
- phpMyAdmin → http://localhost:8080
The Flask app is protected by HTTP Basic Auth.
Use the credentials from .env
:
- Username:
APP_USER
- Password:
APP_PASSWORD
Default example:
Username: admin
Password: superStrongPass123
phpMyAdmin is behind an Nginx proxy with Basic Auth.
You will be prompted twice when accessing http://localhost:8080
:
-
Proxy Authentication – you must create your own
.htpasswd
file (not included in repo).
Generate it with Docker:docker run --rm httpd:alpine htpasswd -nbB myadmin 'MyStrongPass!' > pma-proxy/.htpasswd
In this example:
- Username:
myadmin
- Password:
MyStrongPass!
⚠️ Note:.htpasswd
is not committed to GitHub for security reasons. Each user must generate their own. - Username:
-
phpMyAdmin Login – use your MySQL credentials from
.env
:Username: appuser Password: AppPass123!
docker compose down
If you also want to delete volumes (
docker compose down -v
myapp/
│── docker-compose.yml
│── .env
│── web/
│ ├── app.py
│ └── requirements.txt
│── pma-proxy/
│ ├── nginx.conf
│ └── .htpasswd (⚠️ Not included in repo, generate it yourself)
- Database data is stored in Docker volume
db_data
so it persists across container restarts. - Change
.env
credentials and proxy.htpasswd
before using in production.