-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
71 lines (58 loc) · 1.64 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
FROM boreddevco/alpine-elixir-phoenix:1.11.2 AS phx-builder
# TODO: Use Ubuntu image instead
RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories
# Install `matrex` dependencies.
RUN \
apk --no-cache --update add \
erlang-dev \
build-base \
gcc \
git \
lapack \
lapack-dev \
musl \
libgfortran \
openblas-dev \
openblas && \
rm -rf /var/cache/apk/*
RUN ln -s /usr/include/locale.h /usr/include/xlocale.h
# Set exposed ports
ENV MIX_ENV=prod MATREX_BLAS=openblas
# Cache elixir deps
ADD mix.exs mix.lock ./
RUN mix do clean, deps.get, deps.compile
# Same with npm deps
ADD assets/package.json assets/
RUN cd assets && \
npm install
ADD . .
# Run frontend build, compile, and digest assets
RUN cd assets/ && \
npm run deploy && \
cd - && \
mix do compile, phx.digest && \
mix release --overwrite
FROM boreddevco/alpine-elixir:1.11.2
EXPOSE 4000
ENV PORT=4000 MIX_ENV=prod
RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories
# Install `matrex` dependencies.
RUN \
apk --no-cache --update add \
erlang-dev \
build-base \
gcc \
lapack \
lapack-dev \
musl \
libgfortran \
openblas-dev \
openblas && \
rm -rf /var/cache/apk/*
COPY --from=phx-builder /opt/app/_build /opt/app/_build
COPY --from=phx-builder /opt/app/priv /opt/app/priv
COPY --from=phx-builder /opt/app/config /opt/app/config
COPY --from=phx-builder /opt/app/lib /opt/app/lib
COPY --from=phx-builder /opt/app/deps /opt/app/deps
COPY --from=phx-builder /opt/app/mix.* /opt/app/
CMD ["_build/prod/rel/butler/bin/butler", "start"]