From 4bd75b4a0559a666a7d9fe48eae15d9a3ac717e6 Mon Sep 17 00:00:00 2001 From: Michal Przytulski Date: Thu, 10 Aug 2017 21:35:33 +0100 Subject: [PATCH 1/3] add an option to mount .ssh directory of current user --- index.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index a81b842..149dfd1 100644 --- a/index.js +++ b/index.js @@ -31,6 +31,7 @@ class PkgPyFuncs { this.useDocker = config.useDocker || false this.dockerImage = config.dockerImage || `lambci/lambda:build-${this.serverless.service.provider.runtime}` this.containerName = config.containerName || 'serverless-package-python-functions' + this.mountSSH = config.mountSSH || false } clean(){ @@ -109,11 +110,15 @@ class PkgPyFuncs { if ( out === this.containerName ){ this.log('Container already exists. Reusing.') } else { - this.runProcess( - 'docker', - ['run', '--rm', '-dt', '-v', `${process.cwd()}:/var/task`, - '--name',this.containerName, this.dockerImage, 'bash'] - ) + let args = ['run', '--rm', '-dt', '-v', `${process.cwd()}:/var/task`] + + if (this.mountSSH) { + args = args.concat(['-v', `${process.env.HOME}/.ssh:/root/.ssh`]) + } + + args = args.concat(['--name',this.containerName, this.dockerImage, 'bash']) + + this.runProcess('docker', args) this.log('Container created') } } From 83ff75c60a3faf3b340568cd1deca2ba8ba5be99 Mon Sep 17 00:00:00 2001 From: Andy Byczko Date: Fri, 11 Aug 2017 14:34:25 +0100 Subject: [PATCH 2/3] Skip if function rutime is nodejs6.10 --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 149dfd1..1fcf7d3 100644 --- a/index.js +++ b/index.js @@ -51,7 +51,7 @@ class PkgPyFuncs { } selectAll() { - const functions = this.serverless.service.functions + const functions = _.reject(this.serverless.service.functions, { runtime: 'nodejs6.10' }); const info = _.map(functions, (target) => { return { name: target.name, From 63a05258682fd9496e16a5ef16fee34442c70a37 Mon Sep 17 00:00:00 2001 From: Andy Byczko Date: Mon, 14 Aug 2017 10:06:40 +0100 Subject: [PATCH 3/3] Reject all non python runtimes If there is a runtime specified --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 1fcf7d3..1978612 100644 --- a/index.js +++ b/index.js @@ -51,7 +51,10 @@ class PkgPyFuncs { } selectAll() { - const functions = _.reject(this.serverless.service.functions, { runtime: 'nodejs6.10' }); + const functions = _.reject(this.serverless.service.functions, (target) => { + return target.runtime && !(target.runtime + '').match(/python/i); + }); + const info = _.map(functions, (target) => { return { name: target.name,