forked from glific/glific
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
48 lines (34 loc) · 942 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
48
FROM elixir:1.10.4-alpine as build
MAINTAINER [email protected]
# install build dependencies
RUN apk add --update git nodejs npm
RUN mkdir /app
WORKDIR /app
# install Hex + Rebar
RUN mix do local.hex --force, local.rebar --force
# set build ENV
ENV MIX_ENV=prod
# install mix dependencies
COPY . .
RUN HEX_HTTP_CONCURRENCY=1 HEX_HTTP_TIMEOUT=120 mix deps.get --only prod
RUN mix deps.compile
# build assets
RUN cd assets && npm install && npm run deploy
# build project
RUN mix compile
RUN mix release
# prepare release image
FROM alpine:3.9 AS app
# install runtime dependencies
RUN apk add --update bash openssl postgresql-client
ENV MIX_ENV=prod
# prepare app directory
RUN mkdir /app
WORKDIR /app
# copy release to app container
COPY --from=build /app/_build/prod/rel/prod .
COPY build_scripts/entrypoint.sh .
# RUN chown -R nobody: /app Need to revisit
# USER nobody
ENV HOME=/app
CMD ["bash", "/app/entrypoint.sh"]