Skip to content

Commit 051cd14

Browse files
author
Benjamin Weigel
committed
Extends README.md
1 parent 10f9662 commit 051cd14

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,59 @@
55
[![Github All Releases](https://img.shields.io/github/downloads/hypoport/serverless-custom-packaging-plugin/total.svg)]()
66
[![license](https://img.shields.io/npm/l/serverless-custom-packaging-plugin.svg)]()
77

8+
## What is this plugins purpose?
89

10+
This plugin was originally built to allow deployment of arbitrarily nested python lambdas using serverless. The functionality is related to the one discussed in [this serverless issue (#3366)](https://github.com/serverless/serverless/issues/3366).
911

12+
### The Problem
13+
14+
Vanilla serverless packages your source-code, but retains the folder structure inside the zip-file. However, AWS Lambda can only find the entry-point to your function if it is packaged in a zip-files at root level (see [the AWW-Lambda docs](http://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html)).
15+
16+
### How it was solved
17+
18+
You define a `path` that you want to package inside of serverless's `package` property. The plugin then packages your code, such that te defined path becomes the root-path (`.`) of the package zip-file.
19+
20+
### What else it can do
21+
22+
1. **Custom artifact path**. You can define an `artifact` property. The zip-file will be placed there.
23+
2. If you want to **include only certain file-names or extensions** you may define them using the `include_globs` property.
24+
3. If you have **additional libraries** you need inside the lambda environment you may define a path in the `libs` property. The contents of this folder will be packaged alongside your functions code (in the root of the zip-file). This lets you include arbitrary python modules (i.e. built against the Lambda AMI inside of docker), but keep them away from your code during development.
25+
26+
## How to use it
27+
28+
```yaml
29+
...
30+
functions:
31+
myFunctin:
32+
...
33+
package:
34+
path: path/to/my/code
35+
artifact: path/to/my/artifact.zip
36+
libs: path/to/libs
37+
include_globs:
38+
- "**/*.py"
39+
- "**/*.json"
40+
```
41+
42+
## Tested with ...
43+
44+
| Serverless version | `serverless deploy` | `serverless package -f <function-name>` | `serverless deploy function -f <function_name>` | comment |
45+
|:---:|:---:|:---:|:---:|---:|
46+
| 1.10.0 | <img src=https://cdn.pixabay.com/photo/2017/03/28/01/46/check-mark-2180770_960_720.png width=25> | <img src=https://cdn.pixabay.com/photo/2017/03/28/01/42/attention-2180765_960_720.png width=25>| |
47+
| 1.11.0 | | | | not tested |
48+
| 1.12.0 | | | | not tested |
49+
| 1.13.0 | | | |not tested |
50+
| 1.14.0 | <img src=https://cdn.pixabay.com/photo/2017/03/28/01/46/check-mark-2180770_960_720.png width=25> | <img src=https://cdn.pixabay.com/photo/2017/03/28/01/46/check-mark-2180770_960_720.png width=25> | <img src=https://cdn.pixabay.com/photo/2017/03/28/01/42/attention-2180765_960_720.png width=25> |
51+
| 1.15.0 | <img src=https://cdn.pixabay.com/photo/2017/03/28/01/42/attention-2180765_960_720.png width=25> | <img src=https://cdn.pixabay.com/photo/2017/03/28/01/42/attention-2180765_960_720.png width=25> | <img src=https://cdn.pixabay.com/photo/2017/03/28/01/42/attention-2180765_960_720.png width=25> |
52+
| 1.16.0 | <img src=https://cdn.pixabay.com/photo/2017/03/28/01/46/check-mark-2180770_960_720.png width=25> | <img src=https://cdn.pixabay.com/photo/2017/03/28/01/46/check-mark-2180770_960_720.png width=25> | <img src=https://cdn.pixabay.com/photo/2017/03/28/01/42/attention-2180765_960_720.png width=25> |
53+
| 1.17.0 | <img src=https://cdn.pixabay.com/photo/2017/03/28/01/46/check-mark-2180770_960_720.png width=25> | <img src=https://cdn.pixabay.com/photo/2017/03/28/01/46/check-mark-2180770_960_720.png width=25> | <img src=https://cdn.pixabay.com/photo/2017/03/28/01/42/attention-2180765_960_720.png width=25> / <img src=https://cdn.pixabay.com/photo/2017/03/28/01/46/check-mark-2180770_960_720.png width=25> | everything works when patched |
54+
| 1.18.0 | <img src=https://cdn.pixabay.com/photo/2017/03/28/01/46/check-mark-2180770_960_720.png width=25> | <img src=https://cdn.pixabay.com/photo/2017/03/28/01/46/check-mark-2180770_960_720.png width=25> | <img src=https://cdn.pixabay.com/photo/2017/03/28/01/42/attention-2180765_960_720.png width=25> | `package.individually = true` must be set
55+
56+
### Patches
57+
58+
We have created a couple of patches (so far only for serverless version 1.17.0) to get all the functionality we needed working.
59+
You are free to use these patches, but be aware that this could potentially break (other) serverless functionality.
60+
61+
## A word of caution
62+
63+
This is a work in progress. This means no guarantees that everything will work as promised. If you would like some more functionality you are welcome to contribute. We greatly appreciate any testing you do with different serverless versions and setups.

0 commit comments

Comments
 (0)