Reduce Heroku Compiled Slug Size

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 07:17:53

One thing that helps is adding a .slugignore file to the root of your project to tell Heroku not to compile certain files or directories into the slug. Mine looks like this:

*.psd
*.pdf
test
spec
features
doc
public

The public entry is in there because I serve all static files from Amazon's S3 service; just leave that line off if you're not using an external content-delivery system.

If you're using less/bootstrap, on the cedar stack, then you can reduce slug size by precompiling and scripting up your precompile and push so that the less gem and dependencies are not included see here.

You can also exclude any gems that aren't used in production environment to trim things down a bit. Make sure your Gemfile splits gems according to environment and then exclude those environments that aren't needed.

heroku config:add BUNDLE_WITHOUT="development:test:staging"

Taken from a Heroku blog which is here

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!