Skip to content

Add environment variables to docker run cmd #231

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/pip.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,15 @@ function installRequirements(targetFolder, serverless, options) {
pipCmd.push('--cache-dir', dockerDownloadCacheDir);
}

if (options.dockerEnv) {
// Add environment variables to docker run cmd
options.dockerEnv.forEach(
function(item) {
cmdOptions.push('-e', item);
}
);
}

if (process.platform === 'linux') {
// Use same user so requirements folder is not root and so --cache-dir works
var commands = [];
Expand Down Expand Up @@ -210,7 +219,7 @@ function installRequirements(targetFolder, serverless, options) {
])
);
}
pipCmd = ['/bin/bash', '-c', '"' + commands.join(' && ') + '"'];
pipCmd = ['/bin/bash', '-c', '"' + commands.join(' ; ') + '"'];
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the motivation for changing this? Would you really want to keep running commands if one of them fails?

} else {
// Use same user so --cache-dir works
cmdOptions.push('-u', getDockerUid(bindPath));
Expand Down