feat: 统一生产初始化流程并保护系统管理员
This commit is contained in:
+14
-2
@@ -10,8 +10,6 @@ services:
|
||||
volumes:
|
||||
# 持久化数据到 Linux 本地,防止重启丢失
|
||||
- ./pg_data:/var/lib/postgresql/data
|
||||
# 自动建表脚本
|
||||
- ./database/init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
ports:
|
||||
- "5432:5432"
|
||||
healthcheck:
|
||||
@@ -38,6 +36,20 @@ services:
|
||||
networks:
|
||||
- ctms_net
|
||||
|
||||
backend-init:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
command: python scripts/init_production.py
|
||||
environment:
|
||||
DATABASE_URL: postgresql+asyncpg://ctms_user:secret_password@db/ctms_db
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
profiles: ["init"]
|
||||
networks:
|
||||
- ctms_net
|
||||
|
||||
nginx:
|
||||
build:
|
||||
context: .
|
||||
|
||||
Reference in New Issue
Block a user