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

Allow use of docker container for npm install #251

Merged
merged 9 commits into from
May 1, 2017

Conversation

swhite24
Copy link
Contributor

@swhite24 swhite24 commented Apr 27, 2017

Related to #168
This PR does a couple of things:

  1. Allow a docker image (-I, --dockerImage) to be provided to either the package or deploy command. This image will then be used as the environment in which npm install will be run. An example of the type of image you'd want to use is https://github.com/lambci/docker-lambda .
    There is also an assumption made that the image matches the lambda environment, such as mounting the code directory to and setting the working directory to /var/task.
  2. Changes the code directory to $PWD/.lambda. On a mac, os.tmpDir() resolves to a symlink, which are notoriously difficult to work with when mounting volumes inside a docker container. Changing the code directory seemed like a simple approach to alleviate those concerns, though I realize this is a somewhat inconvenient change.

Example usage:

node-lambda package -I alchemy/lambda:build -A pkg --handler dist/handler.handler  --functionName foo

@DeviaVir DeviaVir self-requested a review May 1, 2017 08:59
Copy link
Collaborator

@DeviaVir DeviaVir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works, and seems like a really clever idea. Thanks for contributing! 👍

@DeviaVir DeviaVir merged commit 6303580 into motdotla:master May 1, 2017
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

Successfully merging this pull request may close these issues.

2 participants