Skip to content

Commit 8e895dd

Browse files
committed
uniqify artifacts to cleanup and allocate a docker tty
1 parent 8bec732 commit 8e895dd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@ class ServerlessPlugin {
3535
// Therefore, the filtering can be disabled to speed up (~3.2s) the process.
3636
this.serverless.service.package.excludeDevDependencies = false;
3737

38-
this.artifacts = [];
38+
// represented as an object for unique keys
39+
this.artifacts = {};
3940
}
4041

4142
runDocker(funcArgs, captureOutput) {
4243
const defaultArgs = [
4344
'run',
4445
'--rm',
46+
'-t',
4547
`-v`, `${this.servicePath}:/code`,
4648
`-v`, `${process.env['HOME']}/.cargo/registry:/root/.cargo/registry`,
4749
`-v`, `${process.env['HOME']}/.cargo/git:/root/.cargo/git`,
@@ -78,12 +80,13 @@ class ServerlessPlugin {
7880
const executablePath = path.resolve('target/lambda/release', crate + '.so');
7981
const targetPath = path.resolve(this.servicePath, crate + '.so');
8082
copyFileSync(executablePath, targetPath);
81-
this.artifacts.push(targetPath);
83+
// only the keys matters
84+
this.artifacts[targetPath] = null;
8285
})
8386
}
8487

8588
clean() {
86-
this.artifacts.forEach(removeSync);
89+
Object.keys(this.artifacts).forEach(removeSync);
8790
}
8891
}
8992

0 commit comments

Comments
 (0)