DEV Community

Discussion on: Building AWS Lambdas for Real World using Ruby and Serverless Framework

Collapse
 
joshuaflanagan profile image
Joshua Flanagan

I just published a serverless plugin to handle a lot of this npmjs.com/package/serverless-ruby-...

The are a couple modifications from the approach you describe. First, the plugin excludes all files by default, so you need to whitelist (add to the package/includes section) any files or directories you want to package.
Second, I recommend bundle install --standalone --path vendor/bundle instead of messing with bundle install --deployment. As you discovered, the "deployment" mode is really only intended for deployment, not active development, so you always need to immediately undo it. Instead, "standalone" accomplishes the part we actually care about, specifically, it copies all of the gem files into the vendor directory in your working directory. The plugin then analyzes your Gemfile to figure out which gems should be included, or excluded if they are in the development/test groups.