@@ -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 . dockerServicePath = '/var/task'
3435 }
3536
3637 clean ( ) {
@@ -74,12 +75,13 @@ class PkgPyFuncs {
7475 }
7576
7677 let cmd = 'pip'
77- let args = [ 'install' , '--upgrade' , '-t' , buildPath , '-r' , requirementsPath ]
7878 if ( this . useDocker === true ) {
7979 cmd = 'docker'
8080 args = [ 'exec' , this . containerName , 'pip' , ...args ]
81+ requirementsPath = `${ this . dockerServicePath } /${ requirementsPath } `
8182 }
8283
84+ args = [ ...args , requirementsPath ]
8385 return this . runProcess ( cmd , args )
8486 }
8587
@@ -111,7 +113,7 @@ class PkgPyFuncs {
111113 } else {
112114 this . runProcess (
113115 'docker' ,
114- [ 'run' , '--rm' , '-dt' , '-v' , `${ process . cwd ( ) } :/var/task ` ,
116+ [ 'run' , '--rm' , '-dt' , '-v' , `${ process . cwd ( ) } :${ this . dockerServicePath } ` ,
115117 '--name' , this . containerName , this . dockerImage , 'bash' ]
116118 )
117119 this . log ( 'Container created' )
0 commit comments