Skip to content

Commit 1a3cb83

Browse files
committed
Add environment variables to docker run cmd
1 parent 49c6f11 commit 1a3cb83

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/pip.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,15 @@ function installRequirements(targetFolder, serverless, options) {
160160
cmdOptions.push('-e', 'SSH_AUTH_SOCK=/tmp/ssh_sock');
161161
}
162162

163+
if (options.dockerEnv) {
164+
// Add environment variables to docker run cmd
165+
options.dockerEnv.forEach(
166+
function(item) {
167+
cmdOptions.push('-e', item);
168+
}
169+
);
170+
}
171+
163172
// If we want a download cache...
164173
const dockerDownloadCacheDir = '/var/useDownloadCache';
165174
if (options.useDownloadCache) {
@@ -210,7 +219,7 @@ function installRequirements(targetFolder, serverless, options) {
210219
])
211220
);
212221
}
213-
pipCmd = ['/bin/bash', '-c', '"' + commands.join(' && ') + '"'];
222+
pipCmd = ['/bin/bash', '-c', '"' + commands.join(' ; ') + '"'];
214223
} else {
215224
// Use same user so --cache-dir works
216225
cmdOptions.push('-u', getDockerUid(bindPath));

0 commit comments

Comments
 (0)