forked from hexpm/hexpm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (35 loc) · 865 Bytes
/
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
FROM elixir:1.6.6-alpine as build
# install build dependencies
RUN apk add --update git build-base nodejs yarn python
# prepare build dir
RUN mkdir /app
WORKDIR /app
# install hex + rebar
RUN mix local.hex --force && \
mix local.rebar --force
# set build ENV
ENV MIX_ENV=prod
# install mix dependencies
COPY mix.exs mix.lock ./
COPY config config
RUN mix deps.get
RUN mix deps.compile
# build assets
COPY assets assets
RUN cd assets && yarn install && yarn run brunch build --production
RUN mix phx.digest
# build project
COPY priv priv
COPY lib lib
RUN mix compile
# build release
COPY rel rel
RUN mix release --no-tar
# prepare release image
FROM alpine:3.6 AS app
RUN apk add --update bash openssl
RUN mkdir /app && chown -R nobody: /app
WORKDIR /app
USER nobody
COPY --from=build /app/_build/prod/rel/hexpm ./
ENV HOME=/app REPLACE_OS_VARS=true