Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ It is important that the host of your private repositories has already been adde
`$HOME/.ssh/known_hosts` file, as the install process will fail otherwise due to host authenticity
failure.

You can also pass environment variables to docker by specifying them in `dockerEnv`
option:
```yaml
custom:
pythonRequirements:
dockerEnv:
- https_proxy
```

[:checkered_flag: Windows notes](#checkered_flag-windows-dockerizepip-notes)

## Pipenv support :sparkles::cake::sparkles:
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class ServerlessPythonRequirements {
dockerSsh: false,
dockerImage: null,
dockerFile: null,
dockerEnv: false,
useStaticCache: false,
useDownloadCache: false,
cacheLocation: false,
Expand Down
7 changes: 7 additions & 0 deletions lib/pip.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,13 @@ function installRequirements(targetFolder, serverless, options) {
pipCmd.push('--cache-dir', quote_single(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