[英]How to dockerize rebar3-erlang application?
我在对我的 rebar3 应用程序进行 dockerizing 时遇到了一些问题。 当我尝试运行应用程序(构建后)时,我收到错误/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}]}]
}]}.
这是我的 Dockerfile
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 does not compile into binary files, you still need the erlang runtime to be able to run the application, yet your final docker image is a fresh alpine install that doesn't have erlang installed
erlang:23
docker 容器是基于 debian 的。 我怀疑该错误是因为该版本是在 debian 容器上生成的,但在 alpine 容器上执行。 从erlang:23-alpine
生成版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.