-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
46 lines (32 loc) · 1.16 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
#================================================================================
# BUILD IMAGE
#================================================================================
FROM elixir:1.5.3 as build
ENV HOME=/app
ENV MIX_ENV=prod REPLACE_OS_VARS=true SHELL=/bin/bash
RUN mix local.hex --force && \
mix local.rebar --force
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \
apt-get install -y nodejs
WORKDIR /app
# Cache elixir deps.
COPY mix.exs mix.lock ./
RUN mix do deps.get, deps.compile
# Cache node deps.
RUN mkdir assets
COPY assets/package.json assets/package-lock.json ./assets/
RUN cd assets && npm install
COPY . .
# Build and digest static assets
RUN cd assets && ./node_modules/brunch/bin/brunch b -p && \
cd .. && mix phx.digest
RUN mix release --env=prod
#================================================================================
# RUN IMAGE
#================================================================================
FROM elixir:1.5.3 as run
ENV HOME=/app
ENV MIX_ENV=prod REPLACE_OS_VARS=true SHELL=/bin/bash
WORKDIR /app
COPY --from=build /app/_build/prod/rel/shovik_com .
ENTRYPOINT ["/app/bin/shovik_com"]