Skip to content

Fix paths for Docker on Windows #141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 5, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions lib/pip.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ function installRequirements(requirementsPath, targetFolder, serverless, service
let cmdOptions;
let pipCmd = [
options.pythonBin, '-m', 'pip', '--isolated', 'install',
'-t', targetRequirementsFolder, '-r', dotSlsReqs,
'-t', dockerPathForWin(options, targetRequirementsFolder),
'-r', dockerPathForWin(options, dotSlsReqs),
...options.pipCmdExtraArgs,
];
if (!options.dockerizePip) {
Expand Down Expand Up @@ -117,7 +118,19 @@ function installRequirements(requirementsPath, targetFolder, serverless, service
};

/**
* create a filtered requirements.txt without anything from noDeploy
* convert path from Windows style to Linux style, if needed
* @param {Object} options
* @param {string} path
* @return {string}
*/
function dockerPathForWin(options, path) {
if (process.platform === 'win32' && options.dockerizePip) {
return path.replace('\\', '/');
}
return path;
}

/** create a filtered requirements.txt without anything from noDeploy
* @param {string} source requirements
* @param {string} target requirements where results are written
* @param {Object} options
Expand Down