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 commit also changes the structure of `output/`.
Since it is possible to build multiple binaries it is useful to have all of them
in unzipped form. So now we put all binaries under `lambda/${PROFILE}/output/${BIN}`.
Only `boostrap` and `boostrap.debug` files reside in this dir.
Copy file name to clipboardExpand all lines: README.md
+26-7Lines changed: 26 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@
6
6
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.
9
+
This provides a build environment, consistent with your target execution environment for predictable results.
10
10
11
11
## 📦 install
12
12
@@ -21,7 +21,7 @@ You can also depend directly on `softprops/lambda-rust:latest` for the most rece
21
21
22
22
## 🤸 usage
23
23
24
-
The default docker entrypoint will build a packaged release optimized version your Rust artifact under `target/lambda/release` to
24
+
The default docker entrypoint will build a packaged release optimized version of your Rust artifact under `target/lambda/release` to
25
25
isolate the lambda specific build artifacts from your host-local build artifacts.
26
26
27
27
> **⚠️ Note:** you can switch from the `release` profile to a custom profile like `dev` by providing a `PROFILE` environment variable set to the name of the desired profile. i.e. `-e PROFILE=dev` in your docker run
@@ -30,7 +30,12 @@ isolate the lambda specific build artifacts from your host-local build artifacts
30
30
31
31
You will want to volume mount `/code` to the directory containing your cargo project.
32
32
33
-
You can pass additional flags to `cargo`, the Rust build tool, by setting the `CARGO_FLAGS` docker env variable
33
+
You can pass additional flags to `cargo`, the Rust build tool, by setting the `CARGO_FLAGS` docker env variable.
34
+
35
+
Unzipped `boostrap` and `boostrap.debug` files are always available
36
+
under `target/lambda/${PROFILE}/output/${BIN}` dir. If you want only them and don't
37
+
need a `.zip` archive (e.g. for when running lambdas locally) pass `-e SKIP_ZIPPING=1`
38
+
flag. More on that in [local testing](#-local-testing).
34
39
35
40
A typical docker run might look like the following.
36
41
@@ -41,7 +46,6 @@ $ docker run --rm \
41
46
-v ${HOME}/.cargo/git:/root/.cargo/git \
42
47
softprops/lambda-rust
43
48
```
44
-
45
49
> 💡 The -v (volume mount) flags for `/root/.cargo/{registry,git}` are optional but when supplied, provides a much faster turn around when doing iterative development
46
50
47
51
If you are using Windows, the command above may need to be modified to include
@@ -85,17 +89,32 @@ You can take a look at an example [here](./tests/test-func-with-hooks).
85
89
86
90
Once you've built a Rust lambda function artifact, the `provided` runtime expects
87
91
deployments of that artifact to be named "**bootstrap**". The `lambda-rust` docker image
88
-
builds a zip file, named after the binary, containing your binary files renamed to "bootstrap" for you.
92
+
builds a zip file, named after the binary, containing your binary file renamed to "bootstrap" for you, but zip file creation is unnecessary for local development.
93
+
94
+
In order to prevent the creation of an intermediate `.zip` artifact when testing your lambdas locally, pass `-e SKIP_ZIPPING=1` during the build. After that the necessary
95
+
output (not zipped) is available under `target/lambda/{profile}/output/{your-lambda-binary-name}` dir.
96
+
You will see both `bootstrap` and `bootstrap.debug` files there.
97
+
> **⚠️ Note:**`SKIP_ZIPPING=1` prevents `package` hook from running.
89
98
90
-
You can invoke this bootstap executable with the lambda-ci docker image for the `provided` AWS lambda runtime with a one off container.
99
+
You can then invoke this bootstap executable with the lambda-ci docker image for the `provided` AWS lambda runtime with a one off container.
91
100
92
101
```sh
102
+
# Build your function skipping the zip creation step
103
+
# You may pass `-e PROFILE=dev` to build using dev profile, but here we use `release`
0 commit comments