erlang 打包Elixir CLI应用程序的最佳方式是什么?

ltqd579y  于 2022-12-08  发布在  Erlang
关注(0)|答案(2)|浏览(139)

假设我有一个带有子命令和参数(如application foo --bar baz)的CLI应用程序,我如何将其打包分发而不要求用户安装Erlang?
我知道有mix escript Mix任务,但它构建了一个需要安装Erlang的二进制文件,Mix引用也声明脚本只应用于开发目的。然而,mix release会生成我不想在dist中看到的冗余shell脚本。
那么,有没有办法使Elixir CLI应用程序成为一个独立的可分发应用程序呢?
P.S.这实际上是我第一次体验Elixir(以及整个Erlang生态系统)

kx5bkwkv

kx5bkwkv1#

Elixir applications can be packaged as Erlang releases , see also here . These can include Erlang VM. Elixir since 1.9 supports building releases without extra tooling, using included mix task mix release - please check the documentation for greasy details: https://hexdocs.pm/mix/Mix.Tasks.Release.html
You might benefit from a quick look at this blog post for inspiration and conceptual overview, noticing that for simple CLI app it is much simpler: https://www.cogini.com/blog/best-practices-for-deploying-elixir-apps/

nnt7mjpx

nnt7mjpx2#

Bakeware generates a single executable file.
They have added a CLI app example here .

相关问题