32 lines
1.0 KiB
YAML
32 lines
1.0 KiB
YAML
name: doodle-store-dev
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:18.6-alpine
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER:-doodle_dev}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?请先复制根目录 .env.example 为 .env 并设置本地密码}
|
|
POSTGRES_DB: ${POSTGRES_DB:-doodle_dev}
|
|
POSTGRES_INITDB_ARGS: '--encoding=UTF8 --locale=C'
|
|
TZ: UTC
|
|
PGTZ: UTC
|
|
command: ['postgres', '-c', 'timezone=UTC']
|
|
ports:
|
|
- '127.0.0.1:${POSTGRES_PORT:-5434}:5432'
|
|
volumes:
|
|
# PostgreSQL 18 的数据目录位于版本子目录,挂载父目录以持久化整个集群。
|
|
- postgres-data:/var/lib/postgresql
|
|
healthcheck:
|
|
test:
|
|
[
|
|
'CMD-SHELL',
|
|
'pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"',
|
|
]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 20
|
|
start_period: 10s
|
|
|
|
volumes:
|
|
postgres-data:
|