I previously documented the process to create a buildpack for nginx to use with Stackato or Helion Dev Platform. In that buildpack example, the compile script would download the nginx source using wget. In some cases, the time, bandwidth or access required to download external resources may be undesirable. In those cases the buildpack can be adjusted to work offline by adding the external resources to the git repository. The new structure would look like this.
Updated compile script
The only bulidpack related file that would need to change to accommodate this is the compile script. The affected section is download and build nginx.
# download and build nginx mkdir -p $cache_dir cp $buildpack_dir/vendor/nginx-1.6.2.tar.gz $cache_dir tar xzf $cache_dir/nginx-1.6.2.tar.gz -C $cache_dir cd $cache_dir/nginx-1.6.2 ./configure make
Notice that now the source is copied from the vendor directory in the buildpack instead downloaded using wget.
Using buildpack branches
In this case I created a branch of my existing buildpack to make these changes. By adding #branchname, it was possible to identify that branch with a in the manifest.yml. In this case my branch name was offline.
--- applications: - name: static-test buildpack: https://github.com/dwatrous/buildpack-nginx.git#offline