wait for postgres container to start. provide env variables through .env file

This commit is contained in:
nouryxd 2024-07-19 22:18:35 +02:00
parent 59a2cbe80f
commit ce701c2230
2 changed files with 13 additions and 11 deletions

View file

@ -10,11 +10,9 @@ TWITCH_CLIENT_SECRET=asd
EVENTSUB_SECRET=asd
DSN=postgres://nourybot:coolpassword@postgres:5432/nourybot?sslmode=disable
DB_HOST=postgres
DB_PORT=5432
DB_USER=nourybot
DB_PASSWORD=coolpassword
DB_NAME=nourybot
POSTGRES_DB=nourybot
POSTGRES_USER=nourybot
POSTGRES_PASSWORD=coolpassword
OWM_KEY=asd
WOLFRAMALPHA_APP_ID=asd

View file

@ -6,19 +6,23 @@ services:
restart: unless-stopped
env_file: .env
depends_on:
- postgres
postgres:
condition: service_healthy
volumes:
- "/tmp/CHANGE_ME/uploads:/public/uploads"
- "/tmp/CHANGEME/uploads:/public/uploads"
ports:
- "127.0.0.1:8080:8080"
postgres:
image: postgres
restart: unless-stopped
environment:
POSTGRES_DB: nourybot
POSTGRES_USER: nourybot
POSTGRES_PASSWORD: coolpassword
env_file: .env
volumes:
- nourybotdb:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 5s
timeout: 5s
retries: 5
start_period: 20s
volumes:
nourybotdb: