Last active
June 7, 2021 14:27
-
-
Save brightball/32ecb94242cd2ad93033629bea719bce to your computer and use it in GitHub Desktop.
Erlang Buildpack
This file contains hidden or 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
#!/bin/bash | |
# Install a custom Erlang version, https://www.erlang.org/ | |
# | |
# Add at least the following environment variables to your project configuration | |
# (otherwise the defaults below will be used). | |
# * ERLANG_VERSION | |
# | |
# Uses https://github.com/elixir-buildpack/heroku-otp/releases | |
# | |
# Include in your builds via | |
# source /dev/stdin <<< "$(curl -sSL https://gist.githubusercontent.com/brightball/32ecb94242cd2ad93033629bea719bce/raw/c677b4f676901ee9b8070ac24f78244782aeea8e/erlang_buildpack.sh)" | |
ERLANG_VERSION=${ERLANG_VERSION:="18.3"} | |
ERLANG_PATH=${ERLANG_PATH:=$HOME/erlang} | |
CACHED_DOWNLOAD="${HOME}/cache/erlang-OTP-${ERLANG_VERSION}.tar.gz" | |
# no set -e because this file is sourced and with the option set a failing command | |
# would cause an infrastructur error message on Codeship. | |
mkdir -p "${ERLANG_PATH}" | |
ERLANG_PATH=$(realpath "${ERLANG_PATH}") | |
wget --continue --output-document "${CACHED_DOWNLOAD}" "https://github.com/elixir-buildpack/heroku-otp/releases/download/${ERLANG_VERSION}/OTP-${ERLANG_VERSION}.tar.gz" | |
tar -xaf "${CACHED_DOWNLOAD}" --strip-components=1 --directory "${ERLANG_PATH}" | |
"${ERLANG_PATH}/Install" -minimal "${ERLANG_PATH}" | |
export PATH="${ERLANG_PATH}/bin:${PATH}" | |
# check the correct version is yused | |
erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), erlang:display(erlang:binary_to_list(Version)), halt().' -noshell | grep "${ERLANG_VERSION}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment