added database to docker

This commit is contained in:
iritmaximus
2023-01-22 20:37:28 +02:00
committed by Aaro Koivukangas
parent 4ee113a7e8
commit 00aba20064
3 changed files with 35 additions and 0 deletions
+1
View File
@@ -6,6 +6,7 @@ scripts
__pycache__ __pycache__
.venv .venv
.env
README.md README.md
+2
View File
@@ -1,2 +1,4 @@
__pycache__ __pycache__
.venv .venv
.env
data
+32
View File
@@ -0,0 +1,32 @@
services:
flask:
# adding this ****ing little **** took at least 3 hours of debugging
command: sh -c "gunicorn -w 4 flaskr:app -b 0.0.0.0:5000"
build:
context: .
dockerfile: Dockerfile
ports:
- "5000:5000"
volumes:
- .:/app
depends_on:
db:
condition: service_healthy
db:
image: postgres:bullseye
volumes:
- ./data/db:/var/lib/postgresql/data
env_file: .env
environment:
- POSTGRES_DB
- POSTGRES_USER
- POSTGRES_PASSWORD
restart: always
healthcheck:
test: sh -c "pg_isready -d ${POSTGRES_DB} -U ${POSTGRES_USER}"
interval: 3s
timeout: 2s
retries: 30