forked from bitwalker/alpine-erlang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
91 lines (85 loc) · 3 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
FROM alpine:3.7
MAINTAINER Paul Schoenfelder <paulschoenfelder@gmail.com>
# Important! Update this no-op ENV variable when this Dockerfile
# is updated with the current date. It will force refresh of all
# of the base images and things like `apt-get update` won't be using
# old cached versions when the Dockerfile is built.
ENV REFRESHED_AT=2018-01-17 \
LANG=en_US.UTF-8 \
HOME=/opt/app/ \
# Set this so that CTRL+G works properly
TERM=xterm \
ERLANG_VERSION=20.2.1
WORKDIR /tmp/erlang-build
# Install Erlang
RUN \
# Create default user and home directory, set owner to default
mkdir -p ${HOME} && \
adduser -s /bin/sh -u 1001 -G root -h ${HOME} -S -D default && \
chown -R 1001:0 ${HOME} && \
# Add tagged repos as well as the edge repo so that we can selectively install edge packages
echo "@main http://dl-cdn.alpinelinux.org/alpine/v3.7/main" >> /etc/apk/repositories && \
echo "@community http://dl-cdn.alpinelinux.org/alpine/v3.7/community" >> /etc/apk/repositories && \
echo "@edge http://nl.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories && \
# Upgrade Alpine and base packages
apk --no-cache upgrade && \
# Distillery requires bash
apk add --no-cache bash@main && \
# Install Erlang/OTP deps
apk add --no-cache pcre@edge && \
apk add --no-cache \
ca-certificates@main \
openssl-dev@main \
ncurses-dev@main \
unixodbc-dev@main \
zlib-dev@main && \
# Install Erlang/OTP build deps
apk add --no-cache --virtual .erlang-build \
dpkg-dev@main dpkg@main \
git@main autoconf@main build-base@main perl-dev@main && \
# Shallow clone Erlang/OTP
git clone -b OTP-$ERLANG_VERSION --single-branch --depth 1 https://github.com/erlang/otp.git . && \
# Erlang/OTP build env
export ERL_TOP=/tmp/erlang-build && \
export PATH=$ERL_TOP/bin:$PATH && \
export CPPFlAGS="-D_BSD_SOURCE $CPPFLAGS" && \
# Configure
./otp_build autoconf && \
./configure --prefix=/usr \
--build="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--without-javac \
--without-wx \
--without-debugger \
--without-observer \
--without-jinterface \
--without-cosEvent\
--without-cosEventDomain \
--without-cosFileTransfer \
--without-cosNotification \
--without-cosProperty \
--without-cosTime \
--without-cosTransactions \
--without-et \
--without-gs \
--without-ic \
--without-megaco \
--without-orber \
--without-percept \
--without-typer \
--enable-threads \
--enable-shared-zlib \
--enable-ssl=dynamic-ssl-lib \
--enable-hipe && \
# Build
make -j4 && make install && \
# Cleanup
apk del --force .erlang-build && \
cd $HOME && \
rm -rf /tmp/erlang-build && \
# Update ca certificates
update-ca-certificates --fresh
WORKDIR ${HOME}
CMD ["/bin/sh"]