erlang / docker-erlang-otp

the Official Erlang OTP image on Docker Hub

Home Page:https://hub.docker.com/_/erlang/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rebar3: not found on latest (24.x) slim image(s)

x80486 opened this issue · comments

I was trying to use the 24-slim image and I'm getting this error:

Step 4/4 : RUN set -eux;   rebar3 eunit --cover;   rebar3 cover --verbose;   rebar3 compile
 ---> Running in 1bac7b7d1be2
+ rebar3 eunit --cover
/bin/sh: 1: rebar3: not found
The command '/bin/sh -c set -eux;   rebar3 eunit --cover;   rebar3 cover --verbose;   rebar3 compile' returned a non-zero code: 127

The exact same Dockerfile definition file, if used with -alpine or just latest works fine:

FROM docker.io/library/erlang:24-slim

WORKDIR /tmp/workspace/

COPY . ./

RUN set -eux; \
  # rebar3 format; \
  rebar3 eunit --cover; \
  rebar3 cover --verbose; \
  rebar3 compile

Is there anything missing in that image?


Logs for -alpine Image

[x80486@uplink:~/erlang_awesone]$ docker build --tag acme/erlang-awesone:latest ./ 
Sending build context to Docker daemon  25.09kB
Step 1/4 : FROM docker.io/library/erlang:24-alpine
24-alpine: Pulling from library/erlang
540db60ca938: Pull complete 
20d61903337f: Pull complete 
Digest: sha256:86a30e8f29e4534261877f55472eeff68d619f90c2dcbc273227d56b72cd16b5
Status: Downloaded newer image for erlang:24-alpine
 ---> bad6285a1962
Step 2/4 : WORKDIR /tmp/workspace/
 ---> Running in ab6a75a0ef7d
Removing intermediate container ab6a75a0ef7d
 ---> 3c0448c27048
Step 3/4 : COPY . ./
 ---> 962a7d9b8008
Step 4/4 : RUN set -eux;   rebar3 eunit --cover;   rebar3 cover --verbose;   rebar3 compile
 ---> Running in dae9c6fb5783
+ rebar3 eunit --cover
=WARNING REPORT==== 21-May-2021::13:58:06.278109 ===
Description: "Authenticity is not established by certificate path validation"
     Reason: "Option {verify, verify_peer} and cacertfile/cacerts is missing"

===> Fetching rebar3_format v1.0.1
===> Fetching katana_code v1.1.1
===> Analyzing applications...
===> Compiling katana_code
===> Compiling rebar3_format
Not formatting the formatter. We're not on the regular compiling cycle
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling erlang_awesone
===> Performing EUnit tests...
......
Finished in 0.054 seconds
6 tests, 0 failures
+ rebar3 cover --verbose
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling erlang_awesone
===> Performing cover analysis...
  |------------------------|------------|
  |                module  |  coverage  |
  |------------------------|------------|
  |           problem_001  |      100%  |
  |           problem_002  |      100%  |
  |------------------------|------------|
  |                 total  |      100%  |
  |------------------------|------------|
  coverage calculated from:
    /tmp/workspace/_build/test/cover/eunit.coverdata
  cover summary written to: /tmp/workspace/_build/test/cover/index.html
+ rebar3 compile
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling erlang_awesone
Removing intermediate container dae9c6fb5783
 ---> 126c0e0e19b9
Successfully built 126c0e0e19b9
Successfully tagged acme/erlang-awesone:latest

Logs for -slim Image

[x80486@uplink:~/erlang_awesone]$ docker build --tag acme/erlang-awesone:latest ./ 
Sending build context to Docker daemon  25.09kB
Step 1/4 : FROM docker.io/library/erlang:24-slim
24-slim: Pulling from library/erlang
d960726af2be: Pull complete 
8bb15c7e621f: Pull complete 
Digest: sha256:cf1bb4e1ad1f291db59598ecdbd56bbcdb002586437e154f1df7644c16790617
Status: Downloaded newer image for erlang:24-slim
 ---> f8d2a5974ee0
Step 2/4 : WORKDIR /tmp/workspace/
 ---> Running in 2b502dfedc99
Removing intermediate container 2b502dfedc99
 ---> b59907cd3942
Step 3/4 : COPY . ./
 ---> 142280b9a04a
Step 4/4 : RUN set -eux;   rebar3 eunit --cover;   rebar3 cover --verbose;   rebar3 compile
 ---> Running in a9530d899a26
+ rebar3 eunit --cover
/bin/sh: 1: rebar3: not found
The command '/bin/sh -c set -eux;   rebar3 eunit --cover;   rebar3 cover --verbose;   rebar3 compile' returned a non-zero code: 127

OK, well...I can see rebar3 is not being installed for that image — that looks like a small oversight 😎

OK, well...I can see rebar3 is not being installed for that image — that looks like a small oversight sunglasses

For -slim images the rebar3 is not provided at all - for all OTP versions.

Do you happen to know (or can point my out to) what could be the reason for that difference between different distros?

Feel free to close this one since it looks like it was not a mistake, but something intended.

rebar3 is tool for build Erlang projects/applications/libraries and not a part of Erlang and not part of Erlang. slim the image is compiled by the Erlang configurator without additional tools etc. You see not all Erlang projects use rebar3 for build projects, some projects is use erlang.mk. Other projects can use something of their own etc. So, I suppose this is expected. And if you will want to use slim with rebar3 you will need to install rebar3 use eg your Dockerfile.

I think rebar3 should be provided in all images.

The plan is, and has been for a while now, to move rebar3 into OTP. This may start to get some actual movement in the not too distant future but including it in all the docker images, like it is a part of OTP already, is a good detail with no downside (an extra meg in size for an image that should only be used for dev/CI anyway).

All right! Good stuff...thanks for the answers! 🍹

@x80486, @tsloughter all slim images from 19 till 24 should have now rebar3.