This repository has been archived by the owner on Nov 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
107 lines (92 loc) · 3.59 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
FROM buildpack-deps:18.04
ENV OTP_VERSION="22.0.7"
# We'll install the build dependencies for erlang-odbc along with the erlang
# build process:
RUN set -xe \
&& OTP_DOWNLOAD_URL="https://github.com/erlang/otp/archive/OTP-${OTP_VERSION}.tar.gz" \
&& OTP_DOWNLOAD_SHA256="04c090b55ec4a01778e7e1a5b7fdf54012548ca72737965b7aa8c4d7878c92bc" \
&& runtimeDeps='libodbc1 \
libsctp1 \
libwxgtk3.0' \
&& buildDeps='unixodbc-dev \
libsctp-dev \
libwxgtk3.0-dev' \
&& apt-get update \
&& apt-get install -y --no-install-recommends $runtimeDeps \
&& apt-get install -y --no-install-recommends $buildDeps \
&& curl -fSL -o otp-src.tar.gz "$OTP_DOWNLOAD_URL" \
&& echo "$OTP_DOWNLOAD_SHA256 otp-src.tar.gz" | sha256sum -c - \
&& 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$(nproc) \
&& make install ) \
&& find /usr/local -name examples | xargs rm -rf \
&& apt-get purge -y --auto-remove $buildDeps \
&& rm -rf $ERL_TOP /var/lib/apt/lists/*
CMD ["erl"]
# extra useful tools here: rebar & rebar3
ENV REBAR_VERSION="2.6.4"
RUN set -xe \
&& REBAR_DOWNLOAD_URL="https://github.com/rebar/rebar/archive/${REBAR_VERSION}.tar.gz" \
&& REBAR_DOWNLOAD_SHA256="577246bafa2eb2b2c3f1d0c157408650446884555bf87901508ce71d5cc0bd07" \
&& mkdir -p /usr/src/rebar-src \
&& curl -fSL -o rebar-src.tar.gz "$REBAR_DOWNLOAD_URL" \
&& echo "$REBAR_DOWNLOAD_SHA256 rebar-src.tar.gz" | sha256sum -c - \
&& tar -xzf rebar-src.tar.gz -C /usr/src/rebar-src --strip-components=1 \
&& rm rebar-src.tar.gz \
&& cd /usr/src/rebar-src \
&& ./bootstrap \
&& install -v ./rebar /usr/local/bin/ \
&& rm -rf /usr/src/rebar-src
ENV REBAR3_VERSION="3.11.1"
RUN set -xe \
&& REBAR3_DOWNLOAD_URL="https://github.com/erlang/rebar3/archive/${REBAR3_VERSION}.tar.gz" \
&& REBAR3_DOWNLOAD_SHA256="a1822db5210b96b5f8ef10e433b22df19c5fc54dfd847bcaab86c65151ce4171" \
&& mkdir -p /usr/src/rebar3-src \
&& curl -fSL -o rebar3-src.tar.gz "$REBAR3_DOWNLOAD_URL" \
&& echo "$REBAR3_DOWNLOAD_SHA256 rebar3-src.tar.gz" | sha256sum -c - \
&& 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
# elixir expects utf8.
ENV ELIXIR_VERSION="v1.9.0" \
LANG=C.UTF-8
RUN set -xe \
&& ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/archive/${ELIXIR_VERSION}.tar.gz" \
&& ELIXIR_DOWNLOAD_SHA256="dbf4cb66634e22d60fe4aa162946c992257f700c7db123212e7e29d1c0b0c487" \
&& curl -fSL -o elixir-src.tar.gz $ELIXIR_DOWNLOAD_URL \
&& echo "$ELIXIR_DOWNLOAD_SHA256 elixir-src.tar.gz" | sha256sum -c - \
&& mkdir -p /usr/local/src/elixir \
&& tar -xzC /usr/local/src/elixir --strip-components=1 -f elixir-src.tar.gz \
&& rm elixir-src.tar.gz \
&& cd /usr/local/src/elixir \
&& make install clean
# Install hex and rebar
RUN mix local.hex --force && \
mix local.rebar --force
ENV MIX_ENV=prod
# Create the application build directory
RUN mkdir /app
WORKDIR /app
# Fetch dependencies
COPY mix.exs .
COPY mix.lock .
RUN mix deps.get
RUN mix deps.compile
# Copy over all the necessary application files and directories
COPY config/config.exs ./config/
COPY config/prod.exs ./config/
COPY config/releases.exs ./config/
COPY lib ./lib
COPY resources ./resources
COPY rel ./rel
CMD ["mix", "release", "--overwrite"]