@panoptic-it-solutions/coolify-setup 1.1.8 → 1.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generator.js +31 -22
- package/dist/templates/dockerfile.js +7 -2
- package/package.json +1 -1
package/dist/generator.js
CHANGED
|
@@ -48,29 +48,38 @@ function addEsbuildToPackageJson(packageManager) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
function moveMigrationsToLibDb() {
|
|
51
|
-
const result = {
|
|
51
|
+
const result = {
|
|
52
|
+
migrations: false,
|
|
53
|
+
helpers: false,
|
|
54
|
+
migrateTs: false,
|
|
55
|
+
queriesTs: false,
|
|
56
|
+
schemaTs: false,
|
|
57
|
+
};
|
|
52
58
|
const cwd = process.cwd();
|
|
53
|
-
//
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
// Items to move from db/ to lib/db/
|
|
60
|
+
const itemsToMove = [
|
|
61
|
+
{ name: 'migrations', resultKey: 'migrations', isDir: true },
|
|
62
|
+
{ name: 'helpers', resultKey: 'helpers', isDir: true },
|
|
63
|
+
{ name: 'migrate.ts', resultKey: 'migrateTs', isDir: false },
|
|
64
|
+
{ name: 'queries.ts', resultKey: 'queriesTs', isDir: false },
|
|
65
|
+
{ name: 'schema.ts', resultKey: 'schemaTs', isDir: false },
|
|
66
|
+
];
|
|
67
|
+
for (const item of itemsToMove) {
|
|
68
|
+
const sourcePath = join(cwd, 'db', item.name);
|
|
69
|
+
const destPath = join(cwd, 'lib/db', item.name);
|
|
70
|
+
if (existsSync(sourcePath) && !existsSync(destPath)) {
|
|
71
|
+
// Ensure lib/db directory exists
|
|
72
|
+
if (item.isDir) {
|
|
73
|
+
ensureDir(join(destPath, 'dummy'));
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
ensureDir(destPath);
|
|
77
|
+
}
|
|
78
|
+
// Move the item
|
|
79
|
+
renameSync(sourcePath, destPath);
|
|
80
|
+
result[item.resultKey] = true;
|
|
81
|
+
console.log(`Moved db/${item.name} → lib/db/${item.name}`);
|
|
82
|
+
}
|
|
74
83
|
}
|
|
75
84
|
// Clean up empty db directory if it exists and is empty
|
|
76
85
|
const dbPath = join(cwd, 'db');
|
|
@@ -33,16 +33,21 @@ function generateNextjsDockerfile(options) {
|
|
|
33
33
|
: '';
|
|
34
34
|
// For Next.js standalone, we bundle the migration script with esbuild at build time
|
|
35
35
|
// This avoids module resolution issues in the minimal standalone container
|
|
36
|
+
// postgres must be externalized due to pnpm's symlink structure causing resolution issues
|
|
36
37
|
const migrationBundle = includePostgres ? `
|
|
37
38
|
|
|
38
39
|
# Build the migration bundle (single JS file with all deps baked in)
|
|
39
40
|
# This avoids module resolution issues in the standalone container
|
|
40
|
-
|
|
41
|
+
# postgres is externalized and copied separately due to pnpm symlink resolution issues
|
|
42
|
+
RUN ${esbuildCmd} lib/db/migrate.ts --bundle --platform=node --target=node22 --outfile=lib/db/migrate.bundle.js --external:dotenv --external:postgres` : '';
|
|
41
43
|
const migrationCopy = includePostgres ? `
|
|
42
44
|
|
|
43
45
|
# Copy database migrations and bundled migration script
|
|
44
46
|
COPY --from=builder --chown=nextjs:nodejs /app/lib/db/migrations ./lib/db/migrations
|
|
45
|
-
COPY --from=builder --chown=nextjs:nodejs /app/lib/db/migrate.bundle.js ./lib/db/migrate.bundle.js
|
|
47
|
+
COPY --from=builder --chown=nextjs:nodejs /app/lib/db/migrate.bundle.js ./lib/db/migrate.bundle.js
|
|
48
|
+
|
|
49
|
+
# Copy postgres module for migration script (externalized from bundle due to pnpm symlinks)
|
|
50
|
+
COPY --from=builder --chown=nextjs:nodejs /app/node_modules/.pnpm/postgres@*/node_modules/postgres ./node_modules/postgres` : '';
|
|
46
51
|
return `# syntax=docker.io/docker/dockerfile:1
|
|
47
52
|
|
|
48
53
|
FROM node:22-alpine AS base
|