Skip to content

gigalixir/gigalixir-buildpack-elixir

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gigalixir Buildpack for Elixir

Features

  • Easy configuration with elixir_buildpack.config file
  • Automatic elixir and erlang version detection if you are using asdf
  • Use prebuilt Elixir binaries
  • Allows configuring Erlang
  • If your app doesn't have a Procfile, default web task mix run --no-halt will be run.
  • Consolidates protocols
  • Hex and rebar support
  • Caching of Hex packages, Mix dependencies and downloads
  • Compilation procedure hooks through hook_pre_compile, hook_compile, hook_post_compile configuration

Version support

Note: you should choose an Elixir and Erlang version that are compatible with one another.

Cloud Native Support

This buildpack is not guaranteed to be Cloud Native compatible. The elixir-buildpack/cloud-native-buildpack is a buildpack that is actively under development and is designed specifically to follow the Cloud Native Buildpack conventions.

Configuration

Create a elixir_buildpack.config file in your app's root dir. The file's syntax is bash.

If you don't specify a config option, then the default option from the buildpack's elixir_buildpack.config file will be used.

Here's a full config file with all available options:

# Erlang version
erlang_version=18.2.1

# Elixir version
elixir_version=1.2.0

# Always rebuild from scratch on every deploy?
always_rebuild=false

# Create a release using `mix release`? (requires Elixir 1.9)
release=true

# A command to run right before fetching dependencies
hook_pre_fetch_dependencies="pwd"

# A command to run right before compiling the app (after elixir, .etc)
hook_pre_compile="pwd"

hook_compile="mix compile --force --warnings-as-errors"

# A command to run right after compiling the app
hook_post_compile="pwd"

# Set the path the app is run from
runtime_path=/app

# Enable or disable additional test arguments
test_args="--cover"

Specifying Elixir version

  • Use prebuilt Elixir release
elixir_version=1.2.0
  • Use prebuilt Elixir branch, the branch specifier ensures that it will be downloaded every time
elixir_version=(branch main)

Specifying Erlang version

  • You can specify an Erlang release version like below
erlang_version=18.2.1

Other notes

  • Add your own Procfile to your application, else the default web task mix run --no-halt will be used.

  • The buildpack will execute the commands configured in hook_pre_compile and/or hook_post_compile in the root directory of your application before/after it has been compiled (respectively). These scripts can be used to build or prepare things for your application, for example compiling assets.

  • The buildpack will execute the commands configured in hook_pre_fetch_dependencies in the root directory of your application before it fetches the application dependencies. This script can be used to clean certain dependencies before fetching new ones.

Tests

Tests are available in the test directory. To run all tests, use for tst in test/*; do $tst; done.

Credits

© Akash Manohar under The MIT License. Feel free to do whatever you want with it.

About

Composable buildpacks

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%