Skip to content

Commit caa5ca2

Browse files
authored
Add ability to define own Docker image. closes #39
2 parents 53a474f + eb1a202 commit caa5ca2

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ custom:
3333
pythonRequirements:
3434
dockerizePip: true
3535
```
36+
To utilize your own Docker container instead of the default, add the following to your `serverless.yml`:
37+
```yaml
38+
custom:
39+
pythonRequirements:
40+
dockerImage: <image name>:tag
41+
```
42+
This must be the full image name and tag to use, including the runtime specific tag if applicable.
3643

3744

3845
## Dealing with Lambda's size limitations

index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,15 @@ class ServerlessPythonRequirements {
6767
}
6868
if (this.custom().dockerizePip) {
6969
cmd = 'docker';
70+
71+
const image = this.custom().dockerImage || `lambci/lambda:build-${runtime}`;
72+
this.serverless.cli.log("Docker Image: " + image)
73+
7074
options = [
7175
'run', '--rm',
7276
'-u', process.getuid() + ':' + process.getgid(),
7377
'-v', `${this.serverless.config.servicePath}:/var/task:z`,
74-
`lambci/lambda:build-${runtime}`,
78+
`${image}`,
7579
];
7680
options.push(...pipCmd);
7781
} else {

0 commit comments

Comments
 (0)