-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
actions/ctr: build erlang/otp and rebar3 ourselves
- Loading branch information
Showing
3 changed files
with
156 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
ARG OTP_VSN="26.1.1" | ||
ARG REBAR_VSN="3.22.1" | ||
ARG ALPINE_VSN="3.18" | ||
|
||
FROM alpine:${ALPINE_VSN} | ||
ARG OTP_VSN | ||
ARG REBAR_VSN | ||
ARG ARCH | ||
|
||
ENV OTP_VERSION="${OTP_VSN}" \ | ||
REBAR3_VERSION="${REBAR_VSN}" | ||
|
||
LABEL org.opencontainers.image.version=$OTP_VERSION | ||
|
||
RUN set -xe \ | ||
&& OTP_DOWNLOAD_URL="https://github.com/erlang/otp/archive/OTP-${OTP_VERSION}.tar.gz" \ | ||
&& apk add --no-cache --virtual .fetch-deps \ | ||
curl \ | ||
ca-certificates \ | ||
&& curl -fSL -o otp-src.tar.gz "$OTP_DOWNLOAD_URL" \ | ||
&& 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_HOST_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 }' \ | ||
)" \ | ||
&& REBAR3_DOWNLOAD_URL="https://github.com/erlang/rebar3/archive/${REBAR3_VERSION}.tar.gz" \ | ||
&& curl -fSL -o rebar3-src.tar.gz "$REBAR3_DOWNLOAD_URL" \ | ||
&& mkdir -p /usr/src/rebar3-src \ | ||
&& tar -xzf rebar3-src.tar.gz -C /usr/src/rebar3-src --strip-components=1 \ | ||
&& rm rebar3-src.tar.gz \ | ||
&& cd /usr/src/rebar3-src \ | ||
&& HOME=$PWD ./bootstrap \ | ||
&& install -v ./rebar3 /usr/local/bin/ \ | ||
&& rm -rf /usr/src/rebar3-src \ | ||
&& apk add --virtual .erlang-rundeps \ | ||
$runDeps \ | ||
lksctp-tools \ | ||
ca-certificates \ | ||
&& apk del .fetch-deps .build-deps | ||
|
||
CMD ["erl"] |