feat: 创建数据库

This commit is contained in:
R524809
2026-10-12 16:56:42 +08:00
parent 3c6fd2c8ca
commit 63a6993276
35 changed files with 826 additions and 266 deletions
+31
View File
@@ -0,0 +1,31 @@
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: