/ Development

Package my custom Cloud Foundry buildpack for offline use

I've made my custom buildpack here but that only works online, I want to make this an offline version.

This should be simple, but initially I had some trouble getting started. Turns out all my troubles came from not having a compatible Go version. On Ubuntu 18.04 when you do a sudo apt-get install golang you will get an older version, NOT suitable for building CF buildpacks.

I used these commands to get a working Go version:

wget https://dl.google.com/go/go1.12.7.linux-amd64.tar.gz

sudo tar -xvf go1.12.7.linux-amd64.tar.gz
sudo mv go /usr/local

export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

Now, clone the buildpack repo with:

git clone https://github.com/floreseken/angular-buildpack.git

In this folder:

source .envrc

go install github.com/cloudfoundry/libbuildpack/packager/buildpack-packager

buildpack-packager build -cached -stack cflinuxfs3

At this point the packager will create a zip file, this is your buildpack. Go get this into Cloud Foundry, do:

cf create-buildpack [BUILDPACK_NAME] [BUILDPACK_ZIP_FILE_PATH] 1

And you are in business:

Capture-4