P: 06-79-21-39-53
E: arthurh.halet@gmail.com
One of our problems is to have custom buildpack which doesn't need internet to find his dependencies. To deal with this issue cloudfoundry create 2 modules:
for git and cntlm run in terminal:
git config --global http.proxy http://localhost:3128
git config --global https.proxy http://localhost:3128
for curl and cntlm run in terminal
echo "proxy=http://localhost:3128" > ~/.curlrc
you can have problem with End Of Line, you MUST HAVE unix EOL in your script file but git when you pull or clone with windows he will all EOL in windows format to bypass this do that in your terminal:
git config --system core.autocrlf false
run your favorite terminal
(if on windows prefer use cygwin)
go to your buildpack source file with your terminal
we will clone the both module from cloudfoundry
in terminal:
git clone https://github.com/cf-buildpacks/buildpack-packager
git clone https://github.com/cf-buildpacks/compile-extensions
create a new file insinde your bin
directory called package
and follow this content template:
#!/usr/bin/env bash
language='<your buildpack language>'
#to get url dependencies a little reverse engineering is needed, just look at pulled url inside your `bin/compile` file
dependencies=(
'url of your first dependencies'
'url of your second dependencies'
'...'
)
excluded_files=(
'.git/'
'.gitignore'
'.gitmodules'
'repos/'
'cf_spec/'
'log/'
'cf.Gemfile'
'cf.Gemfile.lock'
'bin/package'
'buildpack-packager/'
)
BIN="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $BIN/../buildpack-packager/lib/packager
you also need to modify your bin/compile
put this in the beginning of your file:
# CF Common
BUILDPACK_PATH=$(cd $(dirname $0); cd ..; pwd)
export BUILDPACK_PATH
source $BUILDPACK_PATH/compile-extensions/lib/common
# END CF Common
if you are under windows do this before dos2unix bin/*
in your terminal
Compile your offline package by doing this bin/package offline
in your terminal
At the end you will have a zip
file with suffix offline you can create buildpack with this zip file
Create a buildpack in cf with this command:
cf create-buildpack -offline 1
Take a coffee, you've done :)