Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I run a node-based CLI from Docker? #207

Open
rmtuckerphx opened this issue Dec 20, 2017 · 1 comment
Open

How do I run a node-based CLI from Docker? #207

rmtuckerphx opened this issue Dec 20, 2017 · 1 comment

Comments

@rmtuckerphx
Copy link

I am trying to accomplish something similar to: Alpine-less AWS CLI Docker Image
scar init -n lambda-aws-cli grycap/aws-cli
scar run -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY lambda-aws-cli ec2 describe-instances

But my CLI is based on Node 6.10 and is installed by:
npm install -g my-cli

What Docker image should I base this node 6.10 image on?

Then I want to be able to create and run:
scar init -n lambda-my-cli repo/my-image:latest
scar run -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY lambda-my-cli object command

Ultimately, I want to be able to execute commands on my-cli in response to S3 bucket events as in Event-Driven File-Processing Programming Model.

Instead of executing a python script it could execute either the cli command in the above 'run' example or an npm script:

scar init -s deploy.js -n lambda-my-cli -es bucket-name repo/my-image:latest
same as: npm run deploy.js

Can you create a sample that shows a Node Docker image and executing a npm-based cli?

Thanks,

Mark

@gmolto
Copy link
Member

gmolto commented Feb 20, 2018

Hi @rmtuckerphx.

Sorry for the delay. Thank you for your interest in SCAR. While we do not have an example that covers your use case, here are some hints:

  1. Create a Dockerfile and use FROM [node:6-slim] and then install your required Node.JS CLI.
  2. Upload the Docker image to a public Docker Hub repository (or create an Automated Build in Docker Hub).
  3. Pass a shell-script (not a .js file) via the -s parameter of scar run. You can see an example on how to create your .js file before executing it in the mr-bayes example.

Let us know your progress.

Kind regards,
Germán.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants