Skip to content

Commit ae744b7

Browse files
authored
Merge pull request #21 from softprops/bin-target
target binary by name (for upcoming release)
2 parents d22712d + e860f24 commit ae744b7

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

index.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,15 @@ class RustPlugin {
3939
this.serverless.service.package.excludeDevDependencies = false;
4040
}
4141

42-
runDocker(funcArgs, cargoPackage) {
42+
runDocker(funcArgs, cargoPackage, binary) {
4343
const defaultArgs = [
44-
"run",
45-
"--rm",
46-
"-t",
47-
`-v`,
48-
`${this.servicePath}:/code`,
49-
`-v`,
50-
`${process.env["HOME"]}/.cargo/registry:/root/.cargo/registry`,
51-
`-v`,
52-
`${process.env["HOME"]}/.cargo/git:/root/.cargo/git`
44+
'run',
45+
'--rm',
46+
'-t',
47+
'-e', `BIN=${binary}`,
48+
`-v`, `${this.servicePath}:/code`,
49+
`-v`, `${process.env['HOME']}/.cargo/registry:/root/.cargo/registry`,
50+
`-v`, `${process.env['HOME']}/.cargo/git:/root/.cargo/git`,
5351
];
5452
const customArgs = [];
5553
let cargoFlags = (funcArgs || {}).cargoFlags || this.custom.cargoFlags;
@@ -99,7 +97,7 @@ class RustPlugin {
9997
binary = cargoPackage;
10098
}
10199
this.serverless.cli.log(`Building native Rust ${func.handler} func...`);
102-
const res = this.runDocker(func.rust, cargoPackage);
100+
const res = this.runDocker(func.rust, cargoPackage, binary);
103101
if (res.error || res.status > 0) {
104102
this.serverless.cli.log(
105103
`Dockerized Rust build encountered an error: ${res.error} ${

0 commit comments

Comments
 (0)