Public Access
Template
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:
+9
-3
@@ -6,7 +6,7 @@ services:
|
|||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
args:
|
args:
|
||||||
PG_MAJOR: ${PG_MAJOR:-18}
|
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:
|
ports:
|
||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
env_file: .env
|
env_file: .env
|
||||||
@@ -21,7 +21,8 @@ services:
|
|||||||
- .:/app
|
- .:/app
|
||||||
- bundle:/usr/local/bundle
|
- bundle:/usr/local/bundle
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: postgres:${PG_MAJOR:-18}
|
image: postgres:${PG_MAJOR:-18}
|
||||||
@@ -30,7 +31,12 @@ services:
|
|||||||
POSTGRES_USER: ${APP_DATABASE_USERNAME}
|
POSTGRES_USER: ${APP_DATABASE_USERNAME}
|
||||||
POSTGRES_PASSWORD: ${APP_DATABASE_PASSWORD}
|
POSTGRES_PASSWORD: ${APP_DATABASE_PASSWORD}
|
||||||
volumes:
|
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:
|
volumes:
|
||||||
pgdata:
|
pgdata:
|
||||||
|
|||||||
Reference in New Issue
Block a user