-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.prod
77 lines (62 loc) · 1.71 KB
/
Dockerfile.prod
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
72
73
74
75
76
77
FROM elixir:1.9.2-alpine as build
# install build dependencies
RUN apk add --update git build-base nodejs npm 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 --only prod
RUN mix deps.compile
# build assets
COPY assets assets
COPY priv priv
RUN cd assets && npm install && npm run deploy
RUN mix phx.digest
# build project
COPY lib lib
RUN mix compile
# build release (uncomment COPY if rel/ exists)
# COPY rel rel
RUN mix release --overwrite
# prepare release image
FROM alpine:3.9 AS app
RUN apk add --update bash openssl
RUN mkdir /app
WORKDIR /app
COPY --from=build /app/_build/prod/rel/wassup_app ./
RUN chown -R nobody: /app
USER nobody
ENV HOME=/app
# set runtime ENV; for details check '.env.example'
ENV MIX_ENV prod
ENV APP_NAME $APP_NAME
ENV APP_URL $APP_URL
ENV APP_HOSTNAME $APP_HOSTNAME
ENV PORT $PORT
ENV MAIL_SENDER_EMAIL $MAIL_SENDER_EMAIL
ENV SECRET_KEY_BASE $SECRET_KEY_BASE
ENV DATABASE_URL $DATABASE_URL
ENV POOL_SIZE $POOL_SIZE
ENV GOOGLE_CLIENT_ID $GOOGLE_CLIENT_ID
ENV GOOGLE_CLIENT_SECRET $GOOGLE_CLIENT_SECRET
ENV GOOGLE_REDIRECT_URI $GOOGLE_REDIRECT_URI
ENV REGISTRATION_DISABLED $REGISTRATION_DISABLED
ENV SMTP_PROVIDER_DOMAIN $SMTP_PROVIDER_DOMAIN
ENV SMTP_USERNAME $SMTP_USERNAME
ENV SMTP_PASSWORD $SMTP_PASSWORD
ENV GOOGLE_ANALYTICS_TRACKING_ID $GOOGLE_ANALYTICS_TRACKING_ID
EXPOSE $PORT
# Start the containers using:
#
# docker run --rm -d --name wassup_app -p 80:4000 \
# -e SECRET_KEY_BASE=XXXX \
# -e DATABASE_URL=XXXXX \
# wassuphq/wassup:latest \
# bin/wassup_app start