Skip to content

Commit

Permalink
#14 Implemented option to preinstall yums before bundling gem
Browse files Browse the repository at this point in the history
  • Loading branch information
navarasu committed Jul 14, 2020
1 parent e396fa1 commit e2efa66
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,22 @@ function bundleInstall(){
if (ps.error && ps.error.code === 'ENOENT') {
throw new Error('docker command not found');
}
let buildDocker = false;
if (this.options.docker_file) {
fs.copySync(path.join(this.servicePath, this.options.docker_file),
path.join(this.ruby_layer,'Dockerfile'))
buildDocker = true
}else if (this.options.docker_yums) {
docker_steps =['FROM lambci/lambda:build-'+this.serverless.service.provider.runtime]
this.options.docker_yums.forEach(function(package_name) {
docker_steps.push('RUN yum install -y '+package_name)
})
docker_steps.push('RUN gem update bundler')
docker_steps.push('CMD "/bin/bash"')
fs.writeFileSync(path.join(this.ruby_layer,'Dockerfile'),docker_steps.join('\n'))
buildDocker = true
}
if (buildDocker) {
docker_name ='ruby-layer:docker'
docker(['build', '-t', docker_name, '-f', 'Dockerfile', '.'], options,this.cli)
}
Expand Down

0 comments on commit e2efa66

Please sign in to comment.