Last active
August 8, 2016 12:50
-
-
Save jiaaro/e76a776852a68106340a to your computer and use it in GitHub Desktop.
Put the following files in a folder called `bin` (so they'll be `bin/post_compile` and `bin/install_nodejs`)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eo pipefail | |
NODE_VERSION=$(curl --silent --get https://semver.io/node/stable) | |
NODE_BASENAME=node-v${NODE_VERSION}-linux-x64 | |
NODE_ARCHIVE="http://nodejs.org/dist/v${NODE_VERSION}/${NODE_BASENAME}.tar.gz" | |
# make a temp directory | |
tempdir="$( mktemp -t node_XXXX )" | |
rm -rf $tempdir | |
mkdir -p $tempdir | |
pushd $tempdir | |
curl -s -L -o tmp-nodejs.tar.gz $NODE_ARCHIVE | |
tar -zxvf tmp-nodejs.tar.gz > /dev/null | |
rm tmp-nodejs.tar.gz | |
popd | |
mkdir -v -p $BUILD_DIR/.heroku/vendor | |
pushd $BUILD_DIR/.heroku/vendor | |
rm -rf node | |
mv $tempdir/$NODE_BASENAME node | |
popd | |
ln -sf ../../vendor/node/bin/node .heroku/python/bin/node | |
ln -sf ../../vendor/node/bin/node-waf .heroku/python/bin/node-waf | |
ln -sf ../../vendor/node/bin/npm .heroku/python/bin/npm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -veo pipefail | |
# The post_compile hook is run by heroku-buildpack-python | |
echo "-----> Running post-compile hook" | |
# Work around Heroku bug whereby pylibmc isn't available during | |
# compile phase. See: https://github.com/heroku/heroku-buildpack-python/issues/57 | |
export MEMCACHE_SERVERS='' MEMCACHIER_SERVERS='' | |
if [ -f bin/install_nodejs ]; then | |
echo "-----> Running install_nodejs" | |
chmod +x bin/install_nodejs | |
bin/install_nodejs | |
# PUT YOUR NPM INSTALL LINES HERE: (less and iced-coffee-script for example) | |
#npm install -g less | |
#npm install -g iced-coffee-script | |
fi | |
# PUT ANY POST-BUILD STUFF HERE (like database migrations) | |
#python app/manage.py syncdb --noinput | |
#python app/manage.py migrate --noinput | |
echo "-----> Post-compile done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It looks like the
MEMCACHE_SERVERS
workaround isn't needed now, as of:heroku/heroku-buildpack-python@b891049