forward arguments to portainer binary
This commit is contained in:
@@ -9,4 +9,7 @@ WORKDIR /proxy
|
|||||||
RUN npm i express http-proxy-middleware
|
RUN npm i express http-proxy-middleware
|
||||||
COPY app.js .
|
COPY app.js .
|
||||||
|
|
||||||
CMD ["node", "app.js"]
|
COPY docker-entrypoint.sh /
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
||||||
|
|
||||||
|
|||||||
8
app.js
8
app.js
@@ -14,6 +14,7 @@ const INJECTED_HTML = `
|
|||||||
const TARGET_URL = 'http://localhost:19000';
|
const TARGET_URL = 'http://localhost:19000';
|
||||||
const SSL_CERT_PATH = '/data/certs/cert.pem';
|
const SSL_CERT_PATH = '/data/certs/cert.pem';
|
||||||
const SSL_KEY_PATH = '/data/certs/key.pem';
|
const SSL_KEY_PATH = '/data/certs/key.pem';
|
||||||
|
const FORWARDED_ARGS = process.argv.slice(2);
|
||||||
|
|
||||||
// proxy logic
|
// proxy logic
|
||||||
const app = express();
|
const app = express();
|
||||||
@@ -51,7 +52,12 @@ async function runServer() {
|
|||||||
|
|
||||||
// child process for portainer
|
// child process for portainer
|
||||||
function runPortainer() {
|
function runPortainer() {
|
||||||
const child = spawn('/bin/sh', ['-c', '/portainer --bind=":19000" --bind-https=":19443"']);
|
const fwdArgs = FORWARDED_ARGS.join(' ');
|
||||||
|
console.log(`Launching portainer with args ${fwdArgs}`)
|
||||||
|
const child = spawn('/bin/sh', [
|
||||||
|
'-c',
|
||||||
|
`/portainer --bind=":19000" --bind-https=":19443" ${fwdArgs}`
|
||||||
|
]);
|
||||||
child.stdout.pipe(process.stdout);
|
child.stdout.pipe(process.stdout);
|
||||||
child.stderr.pipe(process.stderr);
|
child.stderr.pipe(process.stderr);
|
||||||
child.on('exit', function (code) {
|
child.on('exit', function (code) {
|
||||||
|
|||||||
3
docker-entrypoint.sh
Executable file
3
docker-entrypoint.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
node app.js "$@"
|
||||||
Reference in New Issue
Block a user