-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.web
66 lines (51 loc) · 1.28 KB
/
Dockerfile.web
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
# ---- Build Stage ----
FROM elixir:alpine as build
ENV MIX_ENV=prod \
LANG=C.UTF-8
# Install required packages
RUN apk --no-cache add git nodejs nodejs-npm
# Create the application build directory
RUN mkdir /app
WORKDIR /app
# Install hex and rebar
RUN mix local.hex --force && \
mix local.rebar --force
# 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
RUN cd assets && npm install && npm run deploy
RUN mix phx.digest
# Build elm application
COPY elm elm
RUN cd elm && npm install create-elm-app
RUN cd elm && PUBLIC_URL=/elm ./node_modules/.bin/elm-app build
RUN mv elm/build priv/static/elm
# Build project
COPY priv priv
COPY lib lib
RUN mix compile
COPY README.md README.md
RUN mix docs
# Build release
COPY rel rel
RUN mix release
# ---- App Stage ----
FROM alpine:3.9 AS app
RUN apk add --no-cache bash curl openssh openssl procps python
RUN mkdir /app
WORKDIR /app
ENV HOME=/app
ADD ./.profile.d /app/.profile.d
RUN chmod +x /app/.profile.d/heroku-exec.sh
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# Copy and prepare run script
COPY run.sh .
RUN chmod +x run.sh
COPY --from=build /app/_build/prod/rel/awesome_elixir ./
RUN chown -R nobody: /app
USER nobody
CMD ["./run.sh"]