Unable to start container.
Trouble123 opened this issue · 3 comments
Hi
Can you advise how we need to run the docker image? I tried to just run 'docker run -it ronalddddd/slackgun' but i get the following error. I can imagine i need to specify some of the variables shown on https://github.com/slickplaid/node-slack-mailgun, but as i have no idea on node, i am not sure what i need to do.
npm info it worked if it ends with ok
npm info using npm@3.10.8
npm info using node@v6.9.1
npm info lifecycle mailgun-slack-webhooks@1.0.0prestart: mailgun-slack-webhooks@1.0.0start: mailgun-slack-webhooks@1.0.0
npm info lifecycle mailgun-slack-webhooks@1.0.0
mailgun-slack-webhooks@1.0.0 start /usr/src/app
node slackgun.js
/usr/src/app/slackgun.js:7
if (!apikey) throw new Error('Missing mailgun api key');
^
Error: Missing mailgun api key
at Object. (/usr/src/app/slackgun.js:7:20)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
npm info lifecycle mailgun-slack-webhooks@1.0.0~start: Failed to exec start script
npm ERR! Linux 4.4.0-21-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! mailgun-slack-webhooks@1.0.0 start: node slackgun.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mailgun-slack-webhooks@1.0.0 start script 'node slackgun.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the mailgun-slack-webhooks package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node slackgun.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs mailgun-slack-webhooks
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls mailgun-slack-webhooks
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /usr/src/app/npm-debug.log
thanks
Hi @Trouble123,
These are the environment variables used in the code, along with the port to use:
const apikey = process.env.npm_config_mailgun_key;
const hook = process.env.npm_config_slack_hook;
const channel = process.env.npm_config_slack_channel|| '#general';
// ...
app.listen(8080);
Feel free to help me update the readme, cheers!
Hi, no problem happy to help.
So would it be something like this:
docker run -it -e APIKEY= -e HOOK=https://hooks.slack.com/services/aaa/bbb/ccc ronalddddd/slackgun
thanks
-e npm_config_mailgun_key=xxxxxx
-e ...