Created
August 5, 2023 16:21
-
-
Save torarnv/d2f15f00465e3f618bd0acd57f21e402 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git i/bin/cmds/app/run.js w/bin/cmds/app/run.js | |
index 59d9a37..93fc762 100644 | |
--- i/bin/cmds/app/run.js | |
+++ w/bin/cmds/app/run.js | |
@@ -29,6 +29,12 @@ exports.builder = yargs => { | |
type: 'string', | |
default: '', | |
desc: 'Provide a comma-separated path to local Node.js modules to link. Only works when running the app inside Docker.', | |
+ }) | |
+ .option('network', { | |
+ alias: 'n', | |
+ default: 'bridge', | |
+ type: 'string', | |
+ description: 'Docker network mode. Must match name from `docker network ls`. Only works when running the app inside Docker.', | |
}); | |
}; | |
exports.handler = async yargs => { | |
@@ -39,6 +45,7 @@ exports.handler = async yargs => { | |
clean: yargs.clean, | |
skipBuild: yargs.skipBuild, | |
linkModules: yargs.linkModules, | |
+ network: yargs.network | |
}); | |
} catch (err) { | |
if (err instanceof Error && err.stack) { | |
diff --git i/lib/App.js w/lib/App.js | |
index c4c12eb..ba914bd 100644 | |
--- i/lib/App.js | |
+++ w/lib/App.js | |
@@ -132,6 +132,7 @@ class App { | |
remote = false, | |
skipBuild = false, | |
linkModules = '', | |
+ network = 'bridge', | |
} = {}) { | |
const homey = await AthomApi.getActiveHomey(); | |
@@ -158,6 +159,7 @@ class App { | |
clean, | |
skipBuild, | |
linkModules, | |
+ network, | |
}); | |
} | |
@@ -201,6 +203,7 @@ class App { | |
clean, | |
skipBuild, | |
linkModules, | |
+ network, | |
}) { | |
// Prepare Docker | |
const docker = new Docker(); | |
@@ -674,7 +677,7 @@ class App { | |
}, | |
HostConfig: { | |
ReadonlyRootfs: true, | |
- NetworkMode: 'bridge', | |
+ NetworkMode: network, | |
PortBindings: { | |
[`${inspectPort}/tcp`]: [{ | |
HostPort: String(inspectPort), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment