@flydotio/dockerfile
Advanced tools
Comparing version 0.4.0 to 0.4.1
28
fly.js
@@ -24,4 +24,8 @@ import crypto from 'node:crypto' | ||
// set secrets for remix apps | ||
if (this.remix) this.flyRemixSecrets(this.flyApp) | ||
// set secrets, healthcheck for remix apps | ||
if (this.remix) { | ||
this.flyRemixSecrets(this.flyApp) | ||
this.flyHealthCheck('/healthcheck') | ||
if (this.postgres) this.flyRelease('npx prisma migrate deploy') | ||
} | ||
@@ -228,2 +232,22 @@ // set secrets for AdonisJS apps | ||
// add a deploy/release step | ||
flyRelease(command) { | ||
if (this.flyToml.includes('[deploy]')) return | ||
this.flyToml += `\n[deploy]\n release_command = ${JSON.stringify(command)}` | ||
fs.writeFileSync(this.flyTomlFile, this.flyToml) | ||
} | ||
// set healthcheck endpoint | ||
flyHealthCheck(endpoint) { | ||
if (this.flyToml.match(/\[\[(http_)?services?.(http_)?checks\]\]/)) return | ||
this.flyToml += '\n[[http_service.checks]]\n grace_period = "10s"\n' + | ||
' interval = "30s"\n method = "GET"\n timeout = "5s"\n' + | ||
` path = ${JSON.stringify(endpoint)}\n` | ||
fs.writeFileSync(this.flyTomlFile, this.flyToml) | ||
} | ||
// set various secrets for Remix (and Epic Stack) applications | ||
@@ -230,0 +254,0 @@ flyRemixSecrets(app) { |
12
gdf.js
@@ -110,2 +110,10 @@ import fs from 'node:fs' | ||
get postgres() { | ||
if (this.prisma) { | ||
try { | ||
const schema = fs.readFileSync(path.join(this._appdir, 'prisma/schema.prisma'), 'utf-8') | ||
if (/^\s*provider\s*=\s*"postgresql"/m.test(schema)) return true | ||
} catch { | ||
} | ||
} | ||
return this.adonisjs && !!this.#pj.dependencies?.pg | ||
@@ -524,3 +532,5 @@ } | ||
get entrypoint() { | ||
return this.prisma || (this.options.swap && !this.flySetup()) || this.adonisjs | ||
return (this.prisma && this.sqlite3) || | ||
(this.options.swap && !this.flySetup()) || | ||
this.adonisjs | ||
} | ||
@@ -527,0 +537,0 @@ |
{ | ||
"name": "@flydotio/dockerfile", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Dockerfile generator", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
52890
1080