作为Learn You Some Erlang 的发布章节的一部分,我写了一个关于这个问题的小指南:
这是为使事情变得更小而提供的发布文件之一:
{sys, [
{lib_dirs, ["/home/ferd/code/learn-you-some-erlang/release/"]},
{erts, [{mod_cond, derived},
{app_file, strip}]},
{rel, "erlcount", "1.0.0", [kernel, stdlib, ppool, erlcount]},
{boot_rel, "erlcount"},
{relocatable, true},
{profile, embedded},
{app_file, strip},
{debug_info, strip},
{incl_cond, exclude},
{excl_app_filters, ["_tests.beam$"]},
{app, stdlib, [{mod_cond, derived}, {incl_cond, include}]},
{app, kernel, [{incl_cond, include}]},
{app, ppool, [{vsn, "1.0.0"}, {incl_cond, include}]},
{app, erlcount, [{vsn, "1.0.0"}, {incl_cond, include}]}
]}.
这会剥离调试信息,使应用程序文件尽可能小,删除测试文件,排除尽可能多的应用程序等。请注意,如果您希望人们能够实时运行,您至少需要包含 SASL 并保留 debug_info材料的代码升级。
总而言之,ERTS 本身需要 18.5MB。如果您使用上述规则,这将是您的大部分空间,因此您必须检查是否可以从列表中删除一些可执行文件(非 SMP Erlang 等)。