Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ functions:

The default behavior is to build your lambda inside a docker container. Make sure you have a docker daemon running if you are not opting into the dockerless mode.

## Use with cargo workspaces
Workspaces and per workspace serverless files are now supported. To use it, a custom flag has been added to signal that the serverless.yml is nested in a cargo workspace. Since the binaries will be outputted to a target folder in the workspace root, the zip-copy-process needs to take that into account.

## 🖍️ customize

You can optionally adjust the default settings of the dockerized build env using
Expand All @@ -78,6 +81,8 @@ custom:
dockerTag: 'some-custom-tag'
# custom docker image
dockerImage: 'dockerUser/dockerRepo'
# Using a workspace?
inWorkspace: true # <---- Defaults to false
```

### 🥼 (experimental) local builds
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class RustPlugin {
dockerImage: DEFAULT_DOCKER_IMAGE,
dockerless: false,
strictMode: true,
inWorkspace: false,
},
(this.serverless.service.custom && this.serverless.service.custom.rust) ||
{},
Expand Down Expand Up @@ -168,7 +169,7 @@ class RustPlugin {
const zip = new AdmZip();
zip.addFile(
"bootstrap",
readFileSync(path.join(sourceDir, binary)),
readFileSync(path.join(this.custom.inWorkspace ? '..' : '', sourceDir, binary)),
"",
0o755,
);
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ describe("RustPlugin", () => {
dockerTag: "latest",
dockerless: false,
strictMode: true,
inWorkspace: false
});
});

Expand All @@ -57,6 +58,7 @@ describe("RustPlugin", () => {
dockerTag: "custom-tag",
dockerless: true,
strictMode: false,
inWorkspace: false
},
},
package: {},
Expand All @@ -71,6 +73,7 @@ describe("RustPlugin", () => {
dockerTag: "custom-tag",
dockerless: true,
strictMode: false,
inWorkspace: false
});
});

Expand Down