docker - 如何码头化 rebar3-erlang 应用程序?
问题描述
我在对我的 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 不会编译成二进制文件,您仍然需要 erlang 运行时才能运行应用程序,但您的最终 docker 映像是未安装 erlang 的全新 alpine 安装
推荐阅读
- spring - Spring Boot 应用程序中的多个 RedisConnectionFactories
- c# - 指定的包含路径无效。EntityType 未使用继承集合中的名称声明导航属性
- node.js - 如何在没有错误的情况下为 node.js 安装 strongloop?
- javascript - 在javascript中复制到剪贴板不起作用
- c# - 在 C# MVC 中使用剑道 UI 网格层次结构的客户端模板时,剑道主自动增量 ID 显示在子网格中
- java - 初始化上下文:属性占位符取决于 Maven 配置文件
- r - 从 Leaflet Map R 中删除国家名称等
- sql - SQL Join 和 Distinct 和 Max 问题
- javascript - How to handle an array of Promises then/catch
- bluetooth-lowenergy - 修改蓝牙低功耗扫描参数