Skip to content

Commit

Permalink
Allow the default docker command that packages gems to be overriden
Browse files Browse the repository at this point in the history
Using env variable and include more debug information.
  • Loading branch information
lwoodson committed Aug 29, 2023
1 parent b5744f0 commit 1942b9b
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,23 @@ class PackageRubyBundlePlugin {
const localPath = this.serverless.config.servicePath;
const imageTag = this.serverless.service.provider.runtime.slice(-3);
const dockerImage = `amazon/aws-lambda-ruby:${imageTag}`;
const command = `docker run --rm \
--volume "${localPath}:/var/task" \
--entrypoint '/bin/bash' \
${dockerImage} \
'/var/task/node_modules/serverless-ruby-package/build-gems.sh'`
const default_command = `docker run --rm \
--volume "${localPath}:/var/task" \
--entrypoint '/bin/bash' \
${dockerImage} \
-c '/var/task/node_modules/serverless-ruby-package/build-gems.sh'`
const command = process.env.SRP_DOCKER_COMMAND || default_command;

if (this.config.debug){
this.log(`local path: ${localPath}`);
this.log(`image tag: ${imageTag}`);
this.log(`docker image: ${dockerImage}`);
this.log(`command: ${command}`);
this.log(`docker command: ${command}`);
}
const output = execSync(command)
if (this.config.debug) {
this.log(`docker command output: ${output}`);
}
execSync(command)
}

warnOnUnsupportedRuntime(){
Expand Down

0 comments on commit 1942b9b

Please sign in to comment.