From 425eccff7e0b66822d3a892778adfa5c20c69562 Mon Sep 17 00:00:00 2001 From: Vaibhav871 <72186874+Vaibhav871@users.noreply.github.com> Date: Thu, 25 Jul 2024 18:10:47 +0530 Subject: [PATCH 1/2] Update docker-compose.yml --- docker-compose.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 82df4592..ff2f920b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3' +version: '3.8' services: backend: @@ -10,9 +10,10 @@ services: MYSQL_HOST: mysql MYSQL_USER: admin MYSQL_PASSWORD: admin - MYSQL_DB: myDb + MYSQL_DATABASE: myDb depends_on: - - mysql + mysql: + condition: service_healthy mysql: image: mysql:5.7 @@ -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: From 51e9f1953854306e5c031ee414386bc2518c2575 Mon Sep 17 00:00:00 2001 From: Vaibhav871 <72186874+Vaibhav871@users.noreply.github.com> Date: Thu, 25 Jul 2024 18:14:04 +0530 Subject: [PATCH 2/2] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b8eb7dae..6d3e609a 100644 --- a/README.md +++ b/README.md @@ -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: