如何对rebar3 erlang应用程序进行dockerize?
我在停靠我的rebar3应用程序时遇到了一些问题。当我尝试运行应用程序(在构建后)时,我收到一个错误如何对rebar3 erlang应用程序进行dockerize?,docker,erlang,rebar3,Docker,Erlang,Rebar3,我在停靠我的rebar3应用程序时遇到了一些问题。当我尝试运行应用程序(在构建后)时,我收到一个错误/prod/bin/prod:line 272:/prod/erts-11.2.2.1/bin/erl:not found 这是我的rebar.config: {plugins, [rebar3_hex]}. {deps, [ {cowboy, "2.6.0"}, {eredis, "1.3.3"}, {hackney, "1.17.4
/prod/bin/prod:line 272:/prod/erts-11.2.2.1/bin/erl:not found
这是我的rebar.config:
{plugins, [rebar3_hex]}.
{deps, [
{cowboy, "2.6.0"},
{eredis, "1.3.3"},
{hackney, "1.17.4"},
{jiffy, "1.0.8"}
]}.
{shell, [
% {config, "config/sys.config"},
{apps, [gmm]}
]}.
{relx, [
{release, {prod, "0.0.1"}, [
sasl,
gmm
]}
]}.
{profiles, [{prod, [{relx, [
{dev_mode, false},
{include_erts, true},
{include_src, false},
{debug_info, strip}]}]
}]}.
这是我的文件
FROM erlang:23
RUN mkdir /buildroot
WORKDIR /buildroot
COPY src src/
COPY include include/
COPY rebar.config .
RUN rebar3 as prod release
FROM alpine
RUN apk add --no-cache openssl && \
apk add --no-cache ncurses-libs
COPY --from=0 /buildroot/_build/prod/rel/prod /prod
EXPOSE 8080
CMD ["/prod/bin/prod", "console"]
您知道问题的根源是什么吗?Erlang没有编译成二进制文件,您仍然需要Erlang运行时才能运行应用程序,但是您的最终docker映像是一个全新的alpine安装,没有安装ErlangErlang没有编译成二进制文件,您仍然需要erlang运行时才能运行应用程序,但是您的最终docker映像是一个新的alpine安装,没有安装erlang
erlang:23
docker容器是基于debian的。我怀疑这个错误是因为发布是在debian容器上生成的,但在alpine容器上执行的。从erlang:23
-container生成发行版。erlang:23
docker容器基于debian。我怀疑这个错误是因为发布是在debian容器上生成的,但在alpine容器上执行的。从erlang:23
-container生成发行版。无需在目标计算机/容器上安装erlang。relx
配置{include_erts,true}
将确保发行版与erlang运行时捆绑在一起。无需在目标计算机/容器上安装erlang。relx
configuration{include_erts,true}
将确保发行版与erlang运行时捆绑在一起。谢谢,它解决了问题(进行了少量调整)谢谢,它解决了问题(进行了少量调整)