Skip to content

Commit ec4c522

Browse files
authored
Merge pull request #98 from UnitedIncome/symlink
deal with reqs being a symlink in docker
2 parents 5134169 + 6d33ce2 commit ec4c522

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/pip.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ const {spawnSync} = require('child_process');
77
* @return {Promise}
88
*/
99
function installRequirements() {
10+
const dotSlsReqs = '.serverless/requirements.txt';
1011
let fileName = this.options.fileName;
1112
if (this.options.usePipenv && fse.existsSync(path.join(this.servicePath, 'Pipfile'))) {
12-
fileName = '.serverless/requirements.txt';
13+
fileName = dotSlsReqs;
1314
}
1415

1516
if (!fse.existsSync(path.join(this.servicePath, fileName)))
@@ -38,6 +39,11 @@ function installRequirements() {
3839
pipCmd.push('--system');
3940
}
4041
if (this.options.dockerizePip) {
42+
// In case the requirements file is a symlink, copy it to .serverless/requirements.txt
43+
if (fileName !== dotSlsReqs) {
44+
fse.copySync(fileName, dotSlsReqs);
45+
fileName = dotSlsReqs;
46+
}
4147
cmd = 'docker';
4248

4349
this.serverless.cli.log(`Docker Image: ${this.options.dockerImage}`);

0 commit comments

Comments
 (0)