Priklopi pgdata za PostgreSQL 18, dodaj healthcheck in db:prepare ob zagonu

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-27 14:17:46 +01:00
co-authored by Claude Opus 5.5
parent 4ae5a25766
commit 6081cb247c
+9 -3
View File
@@ -6,7 +6,7 @@ services:
dockerfile: Dockerfile
args:
PG_MAJOR: ${PG_MAJOR:-18}
command: bin/rails server -b 0.0.0.0 -p 3000
command: bash -c "bin/rails db:prepare && bin/rails server -b 0.0.0.0 -p 3000"
ports:
- "3000:3000"
env_file: .env
@@ -21,7 +21,8 @@ services:
- .:/app
- bundle:/usr/local/bundle
depends_on:
- db
db:
condition: service_healthy
db:
image: postgres:${PG_MAJOR:-18}
@@ -30,7 +31,12 @@ services:
POSTGRES_USER: ${APP_DATABASE_USERNAME}
POSTGRES_PASSWORD: ${APP_DATABASE_PASSWORD}
volumes:
- pgdata:/var/lib/postgresql/data
- pgdata:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 2s
timeout: 5s
retries: 15
volumes:
pgdata: