feat(docker): production-ready Dockerfile + Portainer compose stack
- Rewrite Dockerfile: multi-stage pnpm monorepo build with Next.js standalone output, non-root user, minimal runner image - Enable next.config.ts `output: standalone` + serverExternalPackages - Rewrite docker/compose.prod.yml: full production stack with migrate service, minio-init, named networks, build context for Portainer - Add scripts/migrate.mjs: standalone Drizzle migration runner - Update .dockerignore for cleaner build context Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { drizzle } from "drizzle-orm/node-postgres";
|
||||
import { migrate } from "drizzle-orm/node-postgres/migrator";
|
||||
import pg from "pg";
|
||||
|
||||
const { Pool } = pg;
|
||||
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
|
||||
const db = drizzle(pool);
|
||||
|
||||
try {
|
||||
await migrate(db, { migrationsFolder: "/app/packages/db/src/migrations" });
|
||||
console.log("Migrations applied successfully");
|
||||
await pool.end();
|
||||
process.exit(0);
|
||||
} catch (err) {
|
||||
console.error("Migration failed:", err);
|
||||
await pool.end().catch(() => {});
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user