-
Notifications
You must be signed in to change notification settings - Fork 81
/
Dockerfile
51 lines (48 loc) · 1.84 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
FROM alpine:3.8
ENV OTP_VERSION="21.0.3"
RUN set -xe \
&& OTP_DOWNLOAD_URL="https://github.com/erlang/otp/archive/OTP-${OTP_VERSION}.tar.gz" \
&& OTP_DOWNLOAD_SHA256="81ed829f829d53ce7dd7e3808eb3162ef672d52bd3ebc1ad1b6c6dafc06cc324" \
&& apk add --no-cache --virtual .fetch-deps \
curl \
ca-certificates \
&& curl -fSL -o otp-src.tar.gz "$OTP_DOWNLOAD_URL" \
&& echo "$OTP_DOWNLOAD_SHA256 otp-src.tar.gz" | sha256sum -c - \
&& apk add --no-cache --virtual .build-deps \
dpkg-dev dpkg \
gcc \
g++ \
libc-dev \
linux-headers \
make \
autoconf \
ncurses-dev \
openssl-dev \
unixodbc-dev \
lksctp-tools-dev \
tar \
&& export ERL_TOP="/usr/src/otp_src_${OTP_VERSION%%@*}" \
&& mkdir -vp $ERL_TOP \
&& tar -xzf otp-src.tar.gz -C $ERL_TOP --strip-components=1 \
&& rm otp-src.tar.gz \
&& ( cd $ERL_TOP \
&& ./otp_build autoconf \
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
&& ./configure --build="$gnuArch" \
&& make -j$(getconf _NPROCESSORS_ONLN) \
&& make install ) \
&& rm -rf $ERL_TOP \
&& find /usr/local -regex '/usr/local/lib/erlang/\(lib/\|erts-\).*/\(man\|doc\|obj\|c_src\|emacs\|info\|examples\)' | xargs rm -rf \
&& find /usr/local -name src | xargs -r find | grep -v '\.hrl$' | xargs rm -v || true \
&& find /usr/local -name src | xargs -r find | xargs rmdir -vp || true \
&& scanelf --nobanner -E ET_EXEC -BF '%F' --recursive /usr/local | xargs -r strip --strip-all \
&& scanelf --nobanner -E ET_DYN -BF '%F' --recursive /usr/local | xargs -r strip --strip-unneeded \
&& runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)" \
&& apk add --virtual .erlang-rundeps $runDeps lksctp-tools \
&& apk del .fetch-deps .build-deps
CMD ["erl"]