Skip to content

Commit a1ab7d9

Browse files
committed
Add non-linux value for dockerizePip option
1 parent e3070a6 commit a1ab7d9

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ custom:
2626
pythonRequirements:
2727
dockerizePip: true
2828
```
29+
The dockerizePip option supports a special case in addition to booleans of `'non-linux'` which makes
30+
it dockerize only on non-linux environments.
31+
32+
2933
To utilize your own Docker container instead of the default, add the following to your `serverless.yml`:
3034
```yaml
3135
custom:

index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ class ServerlessPythonRequirements {
2020
* @return {Object}
2121
*/
2222
get options() {
23-
return Object.assign({
23+
const options = Object.assign({
2424
zip: false,
2525
cleanupZipHelper: true,
2626
invalidateCaches: false,
2727
fileName: 'requirements.txt',
2828
usePipenv: true,
2929
pythonBin: this.serverless.service.provider.runtime,
30+
dockerizePip: false,
3031
dockerImage: `lambci/lambda:build-${this.serverless.service.provider.runtime}`,
3132
pipCmdExtraArgs: [],
3233
noDeploy: [
@@ -40,8 +41,10 @@ class ServerlessPythonRequirements {
4041
'pip',
4142
'setuptools',
4243
],
43-
}, this.serverless.service.custom &&
44-
this.serverless.service.custom.pythonRequirements || {});
44+
}, this.serverless.service.custom && this.serverless.service.custom.pythonRequirements || {});
45+
if (options.dockerizePip === 'non-linux')
46+
options.dockerizePip = process.platform !== 'linux';
47+
return options;
4548
}
4649

4750
/**

0 commit comments

Comments
 (0)