How can I avoid loading buildpack components from cache on Bluemix?

坚强是说给别人听的谎言 提交于 2019-12-24 03:39:24

问题


I want to automatically download all components of my buildpack from the internet every time I push or re-stage my application to be assured I have the latest versions.

Currently I am seeing cached buildpack components being picked up for

jboss buildpack :https://github.com/cloudfoundry-community/jboss-buildpack. 
-----> Downloaded app package (14M)
-----> Downloaded app buildpack cache (181M)
Cloning into '/tmp/buildpacks/jboss-buildpack'...
-----> Java Buildpack Version: b96641c | https://github.com/cloudfoundry-community/jboss-buildpack#b96641c
-----> Downloading Open Jdk JRE 1.8.0_45 from https://download.run.pivotal.io/openjdk/trusty/x86_64/openjdk-1.8.0_45.tar.gz (found in cache)

回答1:


I discovered that certain buildpacks are written with code to avoid loading stale components alleviating this concern.

For example :

Cloudfoundry Java buildpack : https://github.com/cloudfoundry/java-buildpack has a built-in mechanism to make sure it always uses latest version of the binaries it needs. https://github.com/cloudfoundry/java-buildpack/blob/master/docs/extending-caches.md explains this in detail.

Cloudfoundry Node buildpack : https://github.com/cloudfoundry/nodejs-buildpack has similar functionality using environment variables. You can create a CF environment variable : "NODE_MODULES_CACHE false" which will force the Node.js buildpack will download node modules from the internet every time.

If you are in not sure the buildpack you are using doesn't offer this mechanism , perform following steps :

1) Fork null buildpack : https://github.com/ryandotsmith/null-buildpack

2) add : " rm -rfv $2/* " to null-buildpack/bin/compile file and commit

3) push your application with modified buildpack from Step #2, this step will completely delete contents in cache folder

4) push your application with your desired build pack.

(Reference : https://github.com/perplexes/heroku-buildpack-clearcache)



来源:https://stackoverflow.com/questions/31006154/how-can-i-avoid-loading-buildpack-components-from-cache-on-bluemix

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