File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 2
2
3
3
* bump lambda rust docker version to 0.1.0-rust-1.27.2
4
4
* speed up deployments by ~ 3.2 seconds by disabling excludeDevDependencies. it's on by default but it's not useful for for Rust focused services
5
+ * the ` custom.rust ` config object can be overrided at the function level
6
+
7
+ ``` yaml
8
+ functions :
9
+ hello :
10
+ rust :
11
+ cargoFlags : ' --features ...'
12
+ handler : liblambda.handler
13
+ package :
14
+ include :
15
+ - liblambda.so
16
+ events :
17
+ - schedule : rate(5 minutes)
18
+ ` ` `
5
19
6
20
# 0.1.3
7
21
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ class ServerlessPlugin {
38
38
this . artifacts = [ ] ;
39
39
}
40
40
41
- runDocker ( args , captureOutput ) {
41
+ runDocker ( funcArgs , captureOutput ) {
42
42
const defaultArgs = [
43
43
'run' ,
44
44
'--rm' ,
@@ -47,9 +47,10 @@ class ServerlessPlugin {
47
47
`-v` , `${ process . env [ 'HOME' ] } /.cargo/git:/root/.cargo/git` ,
48
48
] ;
49
49
const customArgs = [ ] ;
50
- if ( this . custom . cargoFlags ) {
50
+ const cargoFlags = ( funcArgs || { } ) . cargoFlags || this . custom . cargoFlags ;
51
+ if ( cargoFlags ) {
51
52
// --features python3-sys, ect
52
- customArgs . push ( '-e' , `CARGO_FLAGS=${ this . custom . cargoFlags } ` ) ;
53
+ customArgs . push ( '-e' , `CARGO_FLAGS=${ cargoFlags } ` ) ;
53
54
} ;
54
55
return spawnSync (
55
56
'docker' ,
@@ -68,7 +69,7 @@ class ServerlessPlugin {
68
69
const func = service . getFunction ( funcName ) ;
69
70
const [ crate , fn ] = func . handler . split ( '.' ) ;
70
71
this . serverless . cli . log ( `Building native Rust ${ func . handler } func...` ) ;
71
- const res = this . runDocker ( ) ;
72
+ const res = this . runDocker ( func . rust ) ;
72
73
if ( res . error || res . status > 0 ) {
73
74
this . serverless . cli . log ( `Dockerized Rust build encountered an error.` ) ;
74
75
throw new Error ( res . error ) ;
You can’t perform that action at this time.
0 commit comments