Skip to content
Open
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
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,16 @@ zipinfo .serverless/xxx.zip

If you can't see the library, you might need to adjust your package include/exclude configuration in `serverless.yml`.

If you would like to recursively include a directory and all of its contents,
prepend `-r ` to the file list member:

```yaml
custom:
pythonRequirements:
dockerExtraFiles:
- -r /path/to/additional/dependencies/
```

## Optimising packaging time

If you wish to exclude most of the files in your project, and only include the source files of your lambdas and their dependencies you may well use an approach like this:
Expand Down
8 changes: 7 additions & 1 deletion lib/pip.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,13 @@ async function installRequirements(targetFolder, pluginInstance) {
}

for (let path of options.dockerExtraFiles) {
pipCmds.push(['cp', path, '/var/task/']);
let cmd = ['cp', path, '/var/task/'];
// Copy recursively if -r option was specified
if (path.startsWith('-r ')) {
path = path.split(' ')[1];
cmd = ['cp', '-r', path, '/var/task/']
}
pipCmds.push(cmd);
}

if (process.platform === 'linux') {
Expand Down