@@ -32,6 +32,7 @@ class PkgPyFuncs {
3232 this . useDocker = config . useDocker || false
3333 this . dockerImage = config . dockerImage || `lambci/lambda:build-${ this . serverless . service . provider . runtime } `
3434 this . containerName = config . containerName || 'serverless-package-python-functions'
35+ this . mountSSH = config . mountSSH || false
3536 this . dockerServicePath = '/var/task'
3637 }
3738
@@ -52,7 +53,10 @@ class PkgPyFuncs {
5253 }
5354
5455 selectAll ( ) {
55- const functions = this . serverless . service . functions
56+ const functions = _ . reject ( this . serverless . service . functions , ( target ) => {
57+ return target . runtime && ! ( target . runtime + '' ) . match ( / p y t h o n / i) ;
58+ } ) ;
59+
5660 const info = _ . map ( functions , ( target ) => {
5761 return {
5862 name : target . name ,
@@ -113,11 +117,14 @@ class PkgPyFuncs {
113117 if ( out === this . containerName ) {
114118 this . log ( 'Container already exists. Reusing.' )
115119 } else {
116- this . runProcess (
117- 'docker' ,
118- [ 'run' , '--rm' , '-dt' , '-v' , `${ process . cwd ( ) } :${ this . dockerServicePath } ` ,
119- '--name' , this . containerName , this . dockerImage , 'bash' ]
120- )
120+ let args = [ 'run' , '--rm' , '-dt' , '-v' , `${ process . cwd ( ) } :${ this . dockerServicePath } ` ]
121+
122+ if ( this . mountSSH ) {
123+ args = args . concat ( [ '-v' , `${ process . env . HOME } /.ssh:/root/.ssh` ] )
124+ }
125+
126+ args = args . concat ( [ '--name' , this . containerName , this . dockerImage , 'bash' ] )
127+ this . runProcess ( 'docker' , args )
121128 this . log ( 'Container created' )
122129 }
123130 }
0 commit comments