Skip to content

Commit b18a29a

Browse files
committed
Allow the default docker command that packages gems to be overriden
Using env variable and include more debug information.
1 parent b5744f0 commit b18a29a

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

index.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,17 +126,23 @@ class PackageRubyBundlePlugin {
126126
const localPath = this.serverless.config.servicePath;
127127
const imageTag = this.serverless.service.provider.runtime.slice(-3);
128128
const dockerImage = `amazon/aws-lambda-ruby:${imageTag}`;
129-
const command = `docker run --rm \
130-
--volume "${localPath}:/var/task" \
131-
--entrypoint '/bin/bash' \
132-
${dockerImage} \
133-
'/var/task/node_modules/serverless-ruby-package/build-gems.sh'`
129+
const default_command = `docker run --rm \
130+
--volume "${localPath}:/var/task" \
131+
--entrypoint '/bin/bash' \
132+
${dockerImage} \
133+
'/var/task/node_modules/serverless-ruby-package/build-gems.sh'`
134+
const command = process.env.SRP_DOCKER_COMMAND || default_command;
134135

135136
if (this.config.debug){
137+
this.log(`local path: ${localPath}`);
138+
this.log(`image tag: ${imageTag}`);
136139
this.log(`docker image: ${dockerImage}`);
137-
this.log(`command: ${command}`);
140+
this.log(`docker command: ${command}`);
141+
}
142+
const output = execSync(command)
143+
if (this.config.debug) {
144+
this.log(`docker command output: ${output}`);
138145
}
139-
execSync(command)
140146
}
141147

142148
warnOnUnsupportedRuntime(){

0 commit comments

Comments
 (0)