From 6d33ce2127a3ac1419749b384719f3d230a9d2e9 Mon Sep 17 00:00:00 2001 From: Daniel Schep Date: Thu, 26 Oct 2017 18:42:52 -0400 Subject: [PATCH] deal with reqs being a symlink in docker closes #97 --- lib/pip.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/pip.js b/lib/pip.js index 3e46fcc5..1edac201 100644 --- a/lib/pip.js +++ b/lib/pip.js @@ -7,9 +7,10 @@ const {spawnSync} = require('child_process'); * @return {Promise} */ function installRequirements() { + const dotSlsReqs = '.serverless/requirements.txt'; let fileName = this.options.fileName; if (this.options.usePipenv && fse.existsSync(path.join(this.servicePath, 'Pipfile'))) { - fileName = '.serverless/requirements.txt'; + fileName = dotSlsReqs; } if (!fse.existsSync(path.join(this.servicePath, fileName))) @@ -38,6 +39,11 @@ function installRequirements() { pipCmd.push('--system'); } if (this.options.dockerizePip) { + // In case the requirements file is a symlink, copy it to .serverless/requirements.txt + if (fileName !== dotSlsReqs) { + fse.copySync(fileName, dotSlsReqs); + fileName = dotSlsReqs; + } cmd = 'docker'; this.serverless.cli.log(`Docker Image: ${this.options.dockerImage}`);