簡體   English   中英

如何碼頭化 rebar3-erlang 應用程序?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM