feat: 从 SQLite 切换到 PostgreSQL

- Prisma provider 改为 postgresql
- docker-compose 新增 postgres 服务(带健康检查)
- Dockerfile 移除 sqlite3/template.db,改用 npm install prisma 做运行时 schema 同步
- docker-entrypoint.sh 简化为 prisma db push + node server.js
This commit is contained in:
2026-02-28 17:47:01 +08:00
parent bf806f0891
commit 827fb761bd
4 changed files with 32 additions and 41 deletions
+27 -3
View File
@@ -1,18 +1,42 @@
services:
postgres:
image: postgres:16-alpine
container_name: no-whatever-db
ports:
- "5432:5432"
environment:
POSTGRES_USER: nowhatever
POSTGRES_PASSWORD: nowhatever
POSTGRES_DB: nowhatever
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U nowhatever"]
interval: 5s
timeout: 3s
retries: 5
restart: unless-stopped
networks:
- nginx
app:
build: .
image: no-whatever:latest
container_name: no-whatever
ports:
- "3000:3000"
volumes:
- /data/no-whatever:/app/data
environment:
- DATABASE_URL=file:/app/data/prod.db
- DATABASE_URL=postgresql://nowhatever:nowhatever@postgres:5432/nowhatever
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
networks:
- nginx
volumes:
pgdata:
networks:
nginx:
external: true