-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
49 lines (36 loc) · 1.15 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
# Build Stage
FROM elixir:1.10 as build
ENV DEBIAN_FRONTEND=noninteractive
ENV HOME=/opt/app/ TERM=xterm
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 http://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get -y install nodejs yarn
## Install Hex Rebar
RUN mix local.hex --force && \
mix local.rebar --force
WORKDIR /opt/app
ENV MIX_ENV=prod
## Cache elixir deps
RUN mkdir config
COPY config/* config/
COPY mix.exs mix.lock ./
RUN mix do deps.get, deps.compile, sentry_recompile
## Cache node deps
COPY assets/*.json ./assets/
COPY assets/yarn.lock ./assets/
RUN cd ./assets && yarn install
## Compile assests & create digest
COPY . .
RUN cd ./assets && ./node_modules/brunch/bin/brunch b -p
RUN mix phx.digest
## Compile Elixir release
RUN MIX_ENV=prod mix distillery.release --env=prod
# Release Stage
FROM elixir:1.10-slim
EXPOSE 4000
ENV PORT=4000 MIX_ENV=prod REPLACE_OS_VARS=true SHELL=/bin/sh
WORKDIR /app
COPY --from=build /opt/app/_build/prod/rel/alloy_ci ./
ENTRYPOINT ["bin/alloy_ci"]