-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
62 lines (40 loc) · 1012 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
49
50
51
52
53
54
55
56
57
58
59
60
61
# -----------------
# BASE
# -----------------
FROM hexpm/elixir:1.11.4-erlang-23.2.7.2-alpine-3.13.3 AS base
WORKDIR /branchpage
RUN mix do local.hex --force, local.rebar --force
RUN apk add npm inotify-tools
# -----------------
# BUILD
# -----------------
FROM base AS build
RUN apk add curl bash git
ARG MIX_ENV=prod
ENV MIX_ENV=$MIX_ENV
COPY . ./
# install application
RUN mix do deps.get, compile
# -----------------
# RELEASE
# -----------------
FROM build AS release
# install node dependencies
RUN npm ci --prefix ./apps/web/assets --no-audit
# generate static files
RUN npm run --prefix ./apps/web/assets deploy
# digests and compresses static files
RUN mix phx.digest
# generate release executable
RUN mix release
# -----------------
# PRODUCTION
# -----------------
FROM alpine:3.13.3
WORKDIR /branchpage
ARG MIX_ENV=prod
# install dependencies
RUN apk add ncurses-libs curl
COPY --from=release /branchpage/_build/$MIX_ENV/rel/web ./
# start application
CMD ["bin/web", "start"]