Skip to content

Commit 4168235

Browse files
committed
docs
1 parent 5d5d869 commit 4168235

File tree

1 file changed

+44
-4
lines changed

1 file changed

+44
-4
lines changed

README.md

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# serverless rust [![Build Status](https://github.com/softprops/serverless-rust/workflows/Main/badge.svg)](https://github.com/softprops/serverless-rust/actions) [![npm](https://img.shields.io/npm/v/serverless-rust.svg)](https://www.npmjs.com/package/serverless-rust)
22

33

4-
> A ⚡ [Serverless framework](https://www.serverless.com/) ⚡ plugin for [Rustlang](https://www.rust-lang.org/en-US/) applications 🦀
4+
> A ⚡ [Serverless framework](https://www.serverless.com/framework/docs/) ⚡ plugin for [Rustlang](https://www.rust-lang.org/) applications 🦀
55
66
## 📦 Install
77

@@ -39,7 +39,7 @@ functions:
3939
method: GET
4040
```
4141
42-
> 💡 The Rust Lambda runtime requires a binary named `bootstrap`. This plugin renames the binary cargo builds to `bootstrap` for you before packaging. You do **not** need to do this manually in your Cargo configuration.
42+
> 💡 The Rust Lambda runtime requires a binary named `bootstrap`. This plugin renames the binary cargo builds to `bootstrap` for you before packaging. You do **not** need to do this manually in your Cargo.toml configuration file.
4343

4444
## 🖍️ customize
4545

@@ -57,11 +57,51 @@ custom:
5757
dockerTag: 'some-custom-tag'
5858
# custom docker image
5959
dockerImage: 'dockerUser/dockerRepo'
60+
```
61+
62+
### 🥼 (experimental) local builds
63+
64+
While it's useful to have a build environment match your deployment
65+
environment dockerized builds do come with some notable tradeoffs.
66+
The external dependency on docker itself often causes friction in an added dependency to your build. If you wish to build lambda's locally, this plugin also supports an experimental `dockerless` mode.
67+
68+
```diff
69+
custom:
70+
# this section allows for customization of the default
71+
# serverless-rust plugin settings
72+
rust:
73+
# flags passed to cargo
74+
cargoFlags: '--features enable-awesome'
6075
# experimental! when set to true, artifacts are built locally outside of docker
61-
dockerless: true
76+
+ dockerless: true
6277
```
6378

64-
> Note. `dockerless` mode is experimental. Windows and OSX will both have to install a separate target with `rustup target add x86_64-unknown-linux-musl`
79+
This will build and link your lambda as a static binary that can be deployed in to the lambda execution environment as a static binary using [MUSL](https://doc.rust-lang.org/edition-guide/rust-2018/platform-and-target-support/musl-support-for-fully-static-binaries.html).
80+
81+
In order to use this mode its expected that you install the `x86_64-unknown-linux-musl` target on all platforms locally with
82+
83+
```sh
84+
$ rustup target add x86_64-unknown-linux-musl
85+
```
86+
87+
On linux platforms, you will need to install musl-tools
88+
89+
```sh
90+
$ sudo apt-get update && sudo apt-get install -y musl-tools
91+
```
92+
93+
On Mac OSX, you will need to install a MUSL cross compilation toolchain
94+
95+
```sh
96+
$ brew install filosottile/musl-cross/musl-cross
97+
```
98+
99+
Using MUSL comes with some other notable tradeoffs. One of which is complications that arise when depending on dynamically linked dependencies.
100+
101+
* With OpenSSL bindings which you can safely replace is with [rustls](https://github.com/ctz/rustls) or [vendor it](https://docs.rs/openssl/0.10.29/openssl/#vendored)
102+
* Other known issues have been reported with [backtrace](https://github.com/KodrAus/rust-cross-compile#limitations).
103+
104+
If you find other MUSL specific issues, please reported them by [opening an issue](https://github.com/softprops/serverless-rust/issues/new?template=bug_report.md).
65105

66106
### 🎨 Per function customization
67107

0 commit comments

Comments
 (0)