Skip to content

Commit 221b6fc

Browse files
committed
Configured MySQL on docker-compose
1 parent 5abe79d commit 221b6fc

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,6 @@ dmypy.json
127127

128128
# Pyre type checker
129129
.pyre/
130+
131+
# Jetbeans IDE
132+
.idea/

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ virtualenv .env
1515
source .env/bin/activate
1616
```
1717

18+
### Run using docker-compose ###
19+
* Make sure docker is running on your hardware
20+
```
21+
docker-compose up -d --build
22+
```
23+
* Go to [localhost](http://localhost:8000)
24+
1825
### Install & Run Fast Api ###
1926
```
2027
pip install fastapi

docker-compose.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
version: '3.9'
2+
23
services:
34
web:
45
build: .
@@ -7,5 +8,28 @@ services:
78
- .:/code
89
ports:
910
- "8000:8000"
10-
#depends_on:
11-
# - db
11+
depends_on:
12+
- db
13+
14+
db:
15+
image: mysql:latest
16+
restart: always
17+
tty: true
18+
environment:
19+
MYSQL_DATABASE: mysql_db
20+
MYSQL_USER: mysql
21+
MYSQL_PASSWORD: mysql
22+
MYSQL_ROOT_PASSWORD: mysql
23+
ports:
24+
- "3307:3306"
25+
volumes:
26+
- mysql_data:/var/lib/mysql/
27+
28+
adminer:
29+
image: adminer:latest
30+
restart: always
31+
ports:
32+
- "8080:8080"
33+
34+
volumes:
35+
mysql_data:

0 commit comments

Comments
 (0)