forked from ellie-app/ellie
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
86 lines (75 loc) · 3.48 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
# This Dockerfile is for production. Ideally I'd like to put it in scripts/docker/production
# but right now Ellie is deployed to zeit.co's now.sh service. now.sh can only find Dockerfiles
# in the root of the project. Development dockerfiles are found in scripts/docker/development.
FROM elixir:1.7.2
ENV DEBIAN_FRONTEND=noninteractive
# Install build-time deps
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get install --no-install-recommends -qy build-essential nodejs \
&& npm install -g npm
# Install libsysconfcpus
RUN git clone https://github.com/obmarg/libsysconfcpus.git /usr/local/src/libsysconfcpus \
&& cd /usr/local/src/libsysconfcpus \
&& ./configure \
&& make \
&& make install \
&& cd / \
&& sysconfcpus --version
ENV MIX_ENV=prod \
NODE_ENV=production \
PORT=4000
# Install Elixir tools
RUN mix local.hex --force \
&& mix local.rebar --force \
&& mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez --force
# Download Elm platform binaries
RUN mkdir -p /tmp/elm_bin/0.18.0 && mkdir -p /tmp/elm_bin/0.19.0 \
# goon executable for Procelain Elixir library, to run executables in Elixir processes
&& wget -q https://github.com/alco/goon/releases/download/v1.1.1/goon_linux_386.tar.gz -O /tmp/goon.tar.gz \
&& tar -xvC /tmp/elm_bin -f /tmp/goon.tar.gz \
&& chmod +x /tmp/elm_bin/goon \
&& rm /tmp/goon.tar.gz \
# Elm Platform 0.18
&& wget -q https://github.com/elm-lang/elm-platform/releases/download/0.18.0-exp/elm-platform-linux-64bit.tar.gz -O /tmp/platform-0.18.0.tar.gz \
&& tar -xvC /tmp/elm_bin/0.18.0 -f /tmp/platform-0.18.0.tar.gz \
&& rm /tmp/platform-0.18.0.tar.gz \
# Elm Format 0.18
&& wget -q https://github.com/avh4/elm-format/releases/download/0.7.0-exp/elm-format-0.18-0.7.0-exp-linux-x64.tgz -O /tmp/format-0.18.0.tar.gz \
&& tar -xvC /tmp/elm_bin/0.18.0 -f /tmp/format-0.18.0.tar.gz \
&& rm /tmp/format-0.18.0.tar.gz \
&& chmod +x /tmp/elm_bin/0.18.0/* \
# Elm Platform 0.19
&& wget -q https://github.com/elm/compiler/releases/download/0.19.0/binaries-for-linux.tar.gz -O /tmp/platform-0.19.0.tar.gz \
&& tar -xvC /tmp/elm_bin/0.19.0 -f /tmp/platform-0.19.0.tar.gz \
&& rm /tmp/platform-0.19.0.tar.gz \
&& chmod +x /tmp/elm_bin/0.19.0/* \
# Elm Format 0.19
&& wget -q https://github.com/avh4/elm-format/releases/download/0.8.0-rc3/elm-format-0.19-0.8.0-rc3-linux-x64.tgz -O /tmp/format-0.19.0.tar.gz \
&& tar -xvC /tmp/elm_bin/0.19.0 -f /tmp/format-0.19.0.tar.gz \
&& rm /tmp/format-0.19.0.tar.gz \
&& chmod +x /tmp/elm_bin/0.19.0/*
# Load source code
ADD . /app
WORKDIR /app
# Copy binaries and set up ELM_HOME
ENV ELM_HOME=/app/priv/elm_home
RUN mkdir -p /app/priv/bin \
&& cp -r /tmp/elm_bin/* /app/priv/bin \
&& mkdir -p /app/priv/elm_home
# Compile Elixir code and generate schema
RUN mix deps.get \
&& mix compile \
&& mix do loadpaths, absinthe.schema.json /app/priv/graphql/schema.json
# Install node dependencies, compile production Elm apps, and generate digested assets
RUN cd /app/assets \
&& npm install \
&& npm run graphql \
&& npm run build \
&& cd /app
# Run the server
RUN echo "Running Ellie on ${SERVER_HOST}"
EXPOSE 4000
CMD mix do ecto.migrate, phx.server