@@ -32,6 +32,7 @@ class PkgPyFuncs {
32
32
this . useDocker = config . useDocker || false
33
33
this . dockerImage = config . dockerImage || `lambci/lambda:build-${ this . serverless . service . provider . runtime } `
34
34
this . containerName = config . containerName || 'serverless-package-python-functions'
35
+ this . mountSSH = config . mountSSH || false
35
36
this . dockerServicePath = '/var/task'
36
37
}
37
38
@@ -52,7 +53,10 @@ class PkgPyFuncs {
52
53
}
53
54
54
55
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
+
56
60
const info = _ . map ( functions , ( target ) => {
57
61
return {
58
62
name : target . name ,
@@ -113,11 +117,14 @@ class PkgPyFuncs {
113
117
if ( out === this . containerName ) {
114
118
this . log ( 'Container already exists. Reusing.' )
115
119
} 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 )
121
128
this . log ( 'Container created' )
122
129
}
123
130
}
0 commit comments