问题
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