Closed CrowdHailer closed 3 years ago
@CrowdHailer I think it should be possible to get the hook working. My guess is that $PATH
is substituted into the string at the wrong time. Specifically, it happens here
https://github.com/HashNuke/heroku-buildpack-elixir/blob/master/lib/misc_funcs.sh#L34
When really, you probably want it to happen here https://github.com/HashNuke/heroku-buildpack-elixir/blob/7d369cf60b8235913eb3397ad201d67411969c3c/lib/app_funcs.sh#L107
I haven't looked into how to get that to happen, but I suspect there are multiple ways of doing this.
Another possibility is to look at the way the phoenix static buildpack depends on this buildpack. It essentially requires that you use multiple buildpacks and that this buildpack is executed before the phoenix static one. This buildpack installs elixir and erlang and updated the PATH
, for example, see
https://github.com/HashNuke/heroku-buildpack-elixir/blob/1251439227711cf28bbfbafc101f9c9ff7f9345a/lib/elixir_funcs.sh#L39
I wonder if something similar can be done with gleam.
I'm not actually using this approach anymore, I ended up with a Docker solution. However I suspect there is still interest in this approach from Gleam folks in general. Might be interesting to see if anyone in the discord channel is interested
If there is anyone interested, I'm looking at this approach again. I've tried making a build pack that installs only the gleam binary. Most of the work is here but I haven't yet figured how to update the PATH so it persistes to separate build steps. https://github.com/midas-framework/gleam_buildpack/blob/main/bin/compile
I'm trying to get a Gleam and Elixir project to run on heroku. Using mix_gleam it's simple to get Gleam and mix working. All that is required is that the Gleam binary is available and on the path.
I was trying to do the simplest thing and make use of compile/precompile hooks. I have a gleam binary in my source code.
And have tried using the following compile hook
Doing this seems to make the mix command unavailable. Same for setting the path in a precompile hook.
I guess there is a more robust way to do this by forking this buildpack, which I guess is my next option. However I'm not sure adding a Gleam option to this buildpack makes sense and Ideally I wouldn't want to be maintaining a forked buildpack.