Skip to content

Commit 4bd75b4

Browse files
committed
add an option to mount .ssh directory of current user
1 parent 116e187 commit 4bd75b4

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

index.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class PkgPyFuncs {
3131
this.useDocker = config.useDocker || false
3232
this.dockerImage = config.dockerImage || `lambci/lambda:build-${this.serverless.service.provider.runtime}`
3333
this.containerName = config.containerName || 'serverless-package-python-functions'
34+
this.mountSSH = config.mountSSH || false
3435
}
3536

3637
clean(){
@@ -109,11 +110,15 @@ class PkgPyFuncs {
109110
if ( out === this.containerName ){
110111
this.log('Container already exists. Reusing.')
111112
} else {
112-
this.runProcess(
113-
'docker',
114-
['run', '--rm', '-dt', '-v', `${process.cwd()}:/var/task`,
115-
'--name',this.containerName, this.dockerImage, 'bash']
116-
)
113+
let args = ['run', '--rm', '-dt', '-v', `${process.cwd()}:/var/task`]
114+
115+
if (this.mountSSH) {
116+
args = args.concat(['-v', `${process.env.HOME}/.ssh:/root/.ssh`])
117+
}
118+
119+
args = args.concat(['--name',this.containerName, this.dockerImage, 'bash'])
120+
121+
this.runProcess('docker', args)
117122
this.log('Container created')
118123
}
119124
}

0 commit comments

Comments
 (0)