diff --git a/index.js b/index.js index 155897ce..c1526b74 100644 --- a/index.js +++ b/index.js @@ -67,6 +67,9 @@ class ServerlessPythonRequirements { if (options.dockerizePip === 'non-linux') { options.dockerizePip = process.platform !== 'linux'; } + if (options.dockerizePip && process.platform === 'win32') { + options.pythonBin = 'python'; + } if ( !options.dockerizePip && (options.dockerSsh || options.dockerImage || options.dockerFile) diff --git a/lib/pip.js b/lib/pip.js index a6285d8c..9a56482c 100644 --- a/lib/pip.js +++ b/lib/pip.js @@ -18,6 +18,13 @@ function quote_single(quoteme) { return quote([quoteme]); } +function quoteFroWin(quoteme) { + if (process.platform === 'win32') { + return `"${quoteme}"`; + } + return quoteme; +} + /** * Just generate the requirements file in the .serverless folder * @param {string} requirementsPath @@ -152,7 +159,7 @@ function installRequirements(targetFolder, serverless, options) { getBindPath(serverless, targetFolder) ); - cmdOptions = ['run', '--rm', '-v', `${bindPath}:/var/task:z`]; + cmdOptions = ['run', '--rm', '-v', quoteFroWin(`${bindPath}:/var/task:z`)]; if (options.dockerSsh) { // Mount necessary ssh files to work with private repos cmdOptions.push( @@ -275,7 +282,7 @@ function installRequirements(targetFolder, serverless, options) { */ function dockerPathForWin(options, path) { if (process.platform === 'win32') { - return `"${path.replace(/\\/g, '/')}"`; + return `${path.replace(/\\/g, '/')}`; } else if (process.platform === 'win32' && !options.dockerizePip) { return path; }