You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This docker image extends [lambda ci `provided`](https://github.com/lambci/docker-lambda#documentation) builder docker image, a faithful reproduction of the actual AWS "**provided**" Lambda runtime environment,
7
7
and installs [rustup](https://rustup.rs/) and the *stable* rust toolchain.
8
8
9
+
This provides a build environment, consistent with your target execution environment for predicable results.
10
+
9
11
## 📦 install
10
12
11
13
Tags for this docker image follow the naming convention `softprops/lambda-rust:{version}-rust-{rust-stable-version}`
@@ -66,13 +68,76 @@ The hooks' names are predefined and must be placed in a directory `.lambda-rust`
66
68
67
69
You can take a look at an example [here](./tests/test-func-with-hooks).
68
70
71
+
## 🔬 local testing
72
+
73
+
Once you've built a Rust lambda function artifact, the `provided` runtime expects
74
+
deployments of that artifact to be named "**bootstrap**". The `lambda-rust` docker image
75
+
builds a zip file, named after the binary, containing your binary files renamed to "bootstrap" for you.
76
+
77
+
You can invoke this bootstap executable with the lambda-ci docker image for the `provided` AWS lambda runtime with a one off container.
78
+
79
+
```sh
80
+
# start a one-off docker container replicating the "provided" lambda runtime
81
+
# awaiting an event to be provided via stdin
82
+
$ unzip -o \
83
+
target/lambda/release/{your-binary-name}.zip \
84
+
-d /tmp/lambda && \
85
+
docker run \
86
+
-i -e DOCKER_LAMBDA_USE_STDIN=1 \
87
+
--rm \
88
+
-v /tmp/lambda:/var/task:ro,delegated \
89
+
lambci/lambda:provided
90
+
91
+
# provide an event payload via stdin (typically a json blob)
92
+
93
+
# Ctrl-D to yield control back to your function
94
+
```
95
+
96
+
If you may find the one-off container less than ideal for if you wish to trigger your lambda multiple times. For these cases try using the "stay open" mode of execution.
97
+
98
+
```sh
99
+
# start a long running docker container replicating the "provided" lambda runtime
100
+
# listening on port 9001
101
+
$ unzip -o \
102
+
target/lambda/release/{your-binary-name}.zip \
103
+
-d /tmp/lambda && \
104
+
docker run \
105
+
--rm \
106
+
-v /tmp/lambda:/var/task:ro,delegated \
107
+
-e DOCKER_LAMBDA_STAY_OPEN=1 \
108
+
-p 9001:9001 \
109
+
lambci/lambda:provided
110
+
```
111
+
112
+
In a separate terminal, you can invoke your function with `curl`
113
+
114
+
The `-d` flag is a means of providing your function's input.
0 commit comments