@flydotio/dockerfile
Advanced tools
Comparing version 0.4.2 to 0.4.3
28
gdf.js
@@ -22,2 +22,3 @@ import fs from 'node:fs' | ||
litefs: false, | ||
nginxRoot: '', | ||
port: 0, | ||
@@ -179,2 +180,3 @@ swap: '', | ||
if (this.prisma) packages.push('openssl') | ||
if (this.options.nginxRoot) packages.push('nginx') | ||
@@ -356,2 +358,17 @@ return packages.sort() | ||
// install modules needed to run | ||
installModules() { | ||
const modules = [] | ||
if (this.options.nginxRoot && !this.#pj.dependencies?.foreman) { | ||
modules.push('foreman') | ||
} | ||
if (modules.length === 0) return | ||
const add = this.packager === 'npm' ? 'install' : 'add' | ||
for (const module of modules) { | ||
execSync(`${this.packager} ${add} ${module}`, { stdio: 'inherit' }) | ||
} | ||
} | ||
// install all dependencies in package.json | ||
@@ -498,2 +515,6 @@ get packagerInstall() { | ||
get foreman() { | ||
if (this.options.nginxRoot) return true | ||
} | ||
// command to start the web server | ||
@@ -608,2 +629,5 @@ get startCommand() { | ||
// install modules needed to run | ||
this.installModules() | ||
if (options.force) this.#answer = 'a' | ||
@@ -639,2 +663,6 @@ | ||
if (this.options.nginxRoot) { | ||
this.options.nginxRoot = path.join('/app', this.options.nginxRoot) | ||
} | ||
for (const [template, filename] of Object.entries(templates)) { | ||
@@ -641,0 +669,0 @@ const dest = await this.#writeTemplateFile(template, filename) |
@@ -60,2 +60,6 @@ #!/usr/bin/env node | ||
}) | ||
.option('nginx-root', { | ||
describe: 'Root directory containing static files to be served by nginx', | ||
type: 'string' | ||
}) | ||
.option('port', { | ||
@@ -62,0 +66,0 @@ describe: 'expose port', |
{ | ||
"name": "@flydotio/dockerfile", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "Dockerfile generator", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -40,2 +40,3 @@ ## Overview | ||
* `--litefs` - configure and enable [litefs](https://fly.io/docs/litefs/). | ||
* `--nginx` - serve static files via [nginx](https://www.nginx.com/). | ||
* `--no-link` - don't add [--link](https://docs.docker.com/engine/reference/builder/#copy---link) to COPY statements. Some tools (like at the moment, [buildah](https://www.redhat.com/en/topics/containers/what-is-buildah)) don't yet support this feature. | ||
@@ -42,0 +43,0 @@ * `--port=n` - expose port (default may vary based on framework, but otherwise is `3000`) |
Sorry, the diff of this file is not supported yet
55353
1121
93