Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Docker compose file and readme file . #45

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,15 @@ Before you begin, make sure you have the following installed:
```

## Usage
1. Install docker compose
```bash
sudo apt-get install docker-compose-v2
```

1. Start the containers using Docker Compose:

```bash
docker-compose up --build
docker compose up -d
```

2. Access the Flask app in your web browser:
Expand Down
16 changes: 11 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3'
version: '3.8'
services:

backend:
Expand All @@ -10,9 +10,10 @@ services:
MYSQL_HOST: mysql
MYSQL_USER: admin
MYSQL_PASSWORD: admin
MYSQL_DB: myDb
MYSQL_DATABASE: myDb
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong change, might break backend

depends_on:
- mysql
mysql:
condition: service_healthy

mysql:
image: mysql:5.7
Expand All @@ -24,8 +25,13 @@ services:
MYSQL_USER: admin
MYSQL_PASSWORD: admin
volumes:
- ./message.sql:/docker-entrypoint-initdb.d/message.sql # Mount sql script into container's /docker-entrypoint-initdb.d directory to get table automatically created
- mysql-data:/var/lib/mysql # Mount the volume for MySQL data storage
- ./message.sql:/docker-entrypoint-initdb.d/message.sql
- mysql-data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 5

volumes:
mysql-data: