Git Product home page Git Product logo

alpine-erlang's Introduction

Erlang on Alpine Linux

This Dockerfile provides a full installation of Erlang on Alpine, intended for running Erlang releases, so it has no build tools installed. The Erlang installation is provided so one can avoid cross-compiling releases. The caveat of course is if one has NIFs which require a native compilation toolchain, but that is left as an exercise for the reader.

NOTE: This image is primarily intended to either be used as-is, or as the base for an image which is embellished with additional dependencies. It is also intended to be forked and tweaked as needed for those applications which require different build configurations of OTP. If the default configuration does not work for you, you will need to take one of the approaches described under Extending for your own application.

Usage

NOTE: This image sets up a default user, with home set to /opt/app and owned by that user. The working directory is also set to $HOME. It is highly recommended that you add a USER default instruction to the end of your Dockerfile so that your app runs in a non-elevated context.

To boot straight to a prompt in the image (versioning info is stripped here, but this is just to give you a general idea of what to expect):

$ docker run --rm -it --user=root bitwalker/alpine-erlang erl
Erlang/OTP XX [erts-X.X] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell VX.X  (abort with ^G)
1>
BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
       (v)ersion (k)ill (D)b-tables (d)istribution
a

Extending for your own application

NOTE: The dependency requirements for your own application may need additional system packages installed via APK, or additional OTP applications from the standard library which are not built by default in order to save space. In the former case, you need to build your own image based on alpine-erlang which installs those extra packages. If you need additional OTP applications from the standard library, you will need to fork alpine-erlang and tweak the config flags for the build so that those applications are present.

FROM bitwalker/alpine-erlang:latest

# Set exposed ports
EXPOSE 5000
ENV PORT=5000

ENV MIX_ENV=prod

ADD yourapp.tar.gz ./

USER default

ENTRYPOINT ["./bin/yourapp"]
CMD ["foreground"]

License

MIT

alpine-erlang's People

Contributors

aeons avatar allenwyma avatar arnodirlam avatar bcinman avatar binaryseed avatar bitwalker avatar drmartinberger avatar edennis avatar ericentin avatar gmile avatar haste avatar icedragon200 avatar jhchabran avatar maco avatar mbaeuerle avatar mustardnoise avatar ntilwalli avatar optikfluffel avatar ssboisen avatar tombruijn avatar tomciopp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alpine-erlang's Issues

openssl-1.1.1d-r3 on alpine 3.11.5 contains CVE-2020-1967

Dear bitwalker,
alpine 3.11.5 that used as based for your alpine-erlang image contains CVE-2020-1967. It is categorize as a high risk CVE. In my pipeline , i used trivy as docker cve scanner. Of course the build will halt when trivy scanned your image. Could you update the openssl package, because alpine is not updated their package yet. Or we just wait for another build.

Alpine Linux v3.8

It looks like a new version of Alpine Linux was released a couple of weeks ago. Is there any reason to hold back on Alpine Linux 3.8?

Question about erlang version

Is there any way to build image with erlang OTP-17.*?
When I just changing the tag name in

git clone -b OTP-19.3 --single-branch --depth 1 https://github.com/erlang/otp.git

to

git clone -b OTP-17.5 --single-branch --depth 1 https://github.com/erlang/otp.git

it fails

Build fails with no pcre edge tag found

Get the below output when trying to build, can be fixed by dropping the edge tag. I'll submit a PR.
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz fetch http://dl.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz WARNING: Ignoring http://dl.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz: No such file or directory WARNING: The repository tag for world dependency 'pcre@edge' does not exist ERROR: Not committing changes due to missing repository tags. Use --force-broken-world to override.

HIPE Compiler

Hi,

I'm trying to build RabbitMQ container that is based on this image, but when i turn on HIPE compiler in MQ it ignores it with error message:

Not HiPE compiling: HiPE not found in this Erlang installation.
=WARNING REPORT==== 29-Aug-2016::00:29:26 ===
Not HiPE compiling: HiPE not found in this Erlang installation.
=INFO REPORT==== 29-Aug-2016::00:29:28 ===

Maybe you can suggest better way to use HIPE compiler on alpine distros?

PCE major vulnerabilities with 19.3 image

When Docker scan an image produced with alpine-erlang:19.3, it finds 3 major vulnerabilities tied with PCRE:

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7246
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7245
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7244

I believe the version 8.40-r2 has been released in Alpine to fix those:

https://pkgs.alpinelinux.org/flag/edge/main/pcre/8.40-r2

Can this be pulled from edge to address the above issues ?

Consider adding documentation/support for NIFS

tag: bitwalker/alpine-erlang:21.0.9

My Elixir project uses this as a base image to build its own elixir from source. Our project uses exml, which in turn uses the Expat XML library via NIFS.

At first, we received the following error after releasing with Distillery:

api_1      | 2019-04-15 15:11:18.702898 crash_report        #{label=>{proc_lib,crash},report=>[[{initial_call,{supervisor,kernel,['Argument__1']}},{pid,<0.2463.0>},{registered_name,[]},{error_info,{exit,{on_load_function_failed,exml_nif},[{init,run_on_load_handlers,0,[]},{kernel,init,1,[{file,"kernel.erl"},{line,212}]},{supervisor,init,1,[{file,"supervisor.erl"},{line,295}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,374}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,342}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}},{ancestors,[kernel_sup,<0.2437.0>]},{message_queue_len,0},{messages,[]},{links,[<0.2439.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,376},{stack_size,27},{reductions,273}],[]]}

Careful troubleshooting revealed that we were missing a few libs:

RUN apk --no-cache add libc6-compat
RUN apk --no-cache add gcc

After adding these to our Dockerbuild the NIF error was resolved. I need to get up to speed on using NIFs, but it would seem these libraries are commonly required to support NIFS and if that is the case then I would advocate for them being in the base image or at least mentioning them in the docs. Troubleshooting this kind of error isn't the most fun thing :)

Some erlang headers are missing in 21.0.3 image

I hope this is the right place...

Most notably ssl_api.hrl

I've tried installing the alpine erlang feature package (i.e erlang-ssl), however that downgrades erlang to 20.x, so no go there

I'm wonder if anyone else knows what's going on, or a possible solution

Expected

Several key erlang headers to exist

Actual

Several key erlang headers are missing

Error on adduser

Hello!

I am trying to get some inspiration (*cough* copy-paste *cough*) the content of this Dockerfile into my own docker file, but I'm getting an error very early:

FROM alpine:3.7

ENV LANG en_US.UTF-8

ENV ERLANG_HOME = /opt/app/ \
    ERLANG_VERSION = 20.1.7

WORKDIR /tmp/erlang-build

RUN mkdir -p ${ERLANG_HOME}
RUN adduser -s /bin/sh -u 1001 -G root -h ${ERLANG_HOME} -S -D default

On windows 10, docker CE 17.09.0-ce-win33 (13620), Channel: stable, I am getting this error:

Sending build context to Docker daemon  451.1kB
Step 1/23 : FROM alpine:3.7
 ---> e21c333399e0
Step 2/23 : ENV LANG en_US.UTF-8
 ---> Using cache
 ---> 41cc764e22e1
Step 3/23 : ENV ERLANG_HOME = /opt/app/     ERLANG_VERSION = 20.1.7
 ---> Using cache
 ---> fd499fd1e897
Step 4/23 : WORKDIR /tmp/erlang-build
 ---> Using cache
 ---> 0772a2816ad9
Step 5/23 : RUN mkdir -p ${ERLANG_HOME}
 ---> Running in e994915b3ce7
 ---> 490c029fed4c
Removing intermediate container e994915b3ce7
Step 6/23 : RUN adduser -s /bin/sh -u 1001 -G root -h ${ERLANG_HOME} -S -D default
 ---> Running in 0064fabda988
BusyBox v1.27.2 (2017-11-28 16:17:30 GMT) multi-call binary.

Usage: adduser [OPTIONS] USER [GROUP]

Create new user, or add USER to GROUP

        -h DIR          Home directory
        -g GECOS        GECOS field
        -s SHELL        Login shell
        -G GRP          Group
        -S              Create a system user
        -D              Don't assign a password
        -H              Don't create home directory
        -u UID          User id
        -k SKEL         Skeleton directory (/etc/skel)
The command '/bin/sh -c adduser -s /bin/sh -u 1001 -G root -h ${ERLANG_HOME} -S -D default' returned a non-zero code: 1

I will try to figure it out, but I thought I would let you know.

Thank you for sharing ๐Ÿ‘

Can't install libstdc++

After recent update, I started to experiment package installation issue on my build process. I have the following instructions on Dockerfile :

FROM bitwalker/alpine-erlang:19.3

RUN apk update && \
    apk --no-cache --update add libgcc libstdc++ bash && \
    rm -rf /var/cache/apk/*

# ...

And it outputs the following error :

ERROR: libstdc++-6.3.0-r4: Protocol error

Other packages are installed correctly.

Auto build docker image with version tag

Hello,

there is easy way how to build docker image with specific version of erlang (elixir).
You just have to add this configuration to builds section in Docker Hub.

{\1}
/^v([0-9.]+)$/

Screenshot 2020-07-22 at 11 50 58

And when you make tag for example with this command:

git tag -a v23.0.3 -m "Erlang OTP 23.0.3" && git push origin v23.0.3

It will build image with that right tag and make nice history of builds in tags section of this github repo.
Note: Maybe there is better command to make git tag.

Support for multiple versions of erlang

@bitwalker As of right now the project only supports the most recent versions of both elixir and alpine linux. Due to the addition of the JIT a lot of libraries in elixir and erlang are not yet compatible with OTP 24. By adding support for multiple versions of erlang we can continue to ensure that people who rely on the most recent long term stable versions while allowing them to stay up to date with the underlying operating system.

Since we've updated to buildx, we should be able to modify the Makefile so that we can build multiple versions of the Dockerfile based on everyone's needs. Let me know what you think.

ARM version

Could be build an ARM version of this image and the elixir image, I would like to use the elixir base image on docker on a pi 4.

unsatisfiable constraints musl-1.1.15-r6 - edge APKINDEX incompatible with 3.5

Due to the presence of the edge repo in the repositories, it now pulls in an incompatible musl lib.
I'm not sure if an update to Alpine 3.6 would solve this.

Expected

Packages to be installed successfully

Actual

+ apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/community/x86_64/APKINDEX.tar.gz
fetch http://nl.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
v3.5.2-119-g586221122a [http://dl-cdn.alpinelinux.org/alpine/v3.5/main]
v3.5.2-110-gd9e62397fb [http://dl-cdn.alpinelinux.org/alpine/v3.5/community]
v3.6.0-1258-gf5668c29cd [http://nl.alpinelinux.org/alpine/edge/main]
OK: 13527 distinct packages available
+ apk --no-cache add build-base git make g++ wget curl inotify-tools nodejs
fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/community/x86_64/APKINDEX.tar.gz
fetch http://nl.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
  musl-1.1.15-r6:
    breaks: musl-dev-1.1.15-r7[musl=1.1.15-r7]
    satisfies: musl-utils-1.1.15-r6[musl=1.1.15-r6]
               musl-utils-1.1.15-r6[so:libc.musl-x86_64.so.1]
               pkgconf-1.0.2-r0[so:libc.musl-x86_64.so.1]
               wget-1.18-r2[so:libc.musl-x86_64.so.1]
               gcc-6.2.1-r1[so:libc.musl-x86_64.so.1]
               inotify-tools-3.14-r2[so:libc.musl-x86_64.so.1]
               binutils-libs-2.27-r1[so:libc.musl-x86_64.so.1]
               libcrypto1.0-1.0.2k-r0[so:libc.musl-x86_64.so.1]
               g++-6.2.1-r1[so:libc.musl-x86_64.so.1]
               readline-6.3.008-r4[so:libc.musl-x86_64.so.1]
               http-parser-2.7.1-r0[so:libc.musl-x86_64.so.1]
               mpfr3-3.1.5-r0[so:libc.musl-x86_64.so.1]
               libuv-1.9.1-r0[so:libc.musl-x86_64.so.1]
               ncurses-libs-6.0-r7[so:libc.musl-x86_64.so.1]
               libstdc++-6.2.1-r1[so:libc.musl-x86_64.so.1]
               nodejs-6.9.5-r0[so:libc.musl-x86_64.so.1]
               isl-0.17.1-r0[so:libc.musl-x86_64.so.1]
               libcurl-7.52.1-r3[so:libc.musl-x86_64.so.1]
               mpc1-1.0.3-r0[so:libc.musl-x86_64.so.1]
               libressl2.4-libcrypto-2.4.4-r0[so:libc.musl-x86_64.so.1]
               git-2.11.2-r0[so:libc.musl-x86_64.so.1]
               pcre-8.40-r2[so:libc.musl-x86_64.so.1]
               unixodbc-2.3.4-r0[so:libc.musl-x86_64.so.1]
               libressl2.4-libssl-2.4.4-r0[so:libc.musl-x86_64.so.1]
               zlib-1.2.8-r2[so:libc.musl-x86_64.so.1]
               libgomp-6.2.1-r1[so:libc.musl-x86_64.so.1]
               apk-tools-2.6.8-r2[so:libc.musl-x86_64.so.1]
               libssh2-1.7.0-r2[so:libc.musl-x86_64.so.1]
               libgcc-6.2.1-r1[so:libc.musl-x86_64.so.1]
               make-4.2.1-r0[so:libc.musl-x86_64.so.1]
               curl-7.52.1-r3[so:libc.musl-x86_64.so.1]
               alpine-baselayout-3.0.4-r0[so:libc.musl-x86_64.so.1]
               libatomic-6.2.1-r1[so:libc.musl-x86_64.so.1]
               ca-certificates-20161130-r1[so:libc.musl-x86_64.so.1]
               gmp-6.1.1-r0[so:libc.musl-x86_64.so.1]
               busybox-1.25.1-r0[so:libc.musl-x86_64.so.1]
               scanelf-1.1.6-r0[so:libc.musl-x86_64.so.1]
               expat-2.2.0-r0[so:libc.musl-x86_64.so.1]
               binutils-2.27-r1[so:libc.musl-x86_64.so.1]
               libssl1.0-1.0.2k-r0[so:libc.musl-x86_64.so.1]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.