feat(deploy): 一条命令链部署——双单文件 + Caddy + DATABASE_URL 单源

多阶段镜像编出 server/engine 单文件与前端静态;compose 起 pg/server/engine/caddy;
启动时自动迁移;仅用 DATABASE_URL,postgres 建库参数由 entrypoint 拆解。
This commit is contained in:
2026-10-10 16:46:54 +08:00
parent 5f76bfc9d6
commit ea4efbe1d7
12 changed files with 258 additions and 18 deletions
+6
View File
@@ -1,4 +1,5 @@
import { drizzle } from "drizzle-orm/postgres-js";
import { migrate } from "drizzle-orm/postgres-js/migrator";
import postgres from "postgres";
import * as schema from "./schema.ts";
@@ -9,5 +10,10 @@ export function createDb(connectionString: string) {
export type Db = ReturnType<typeof createDb>;
/** 启动时按 journal 应用缺失迁移(幂等);`migrationsFolder` 指向 drizzle/ 目录 */
export async function runMigrations(db: Db, migrationsFolder: string) {
await migrate(db, { migrationsFolder });
}
export * from "./schema.ts";
export * from "./repos.ts";