-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (39 loc) · 1.48 KB
/
Copy pathDockerfile
File metadata and controls
66 lines (39 loc) · 1.48 KB
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
ARG ALPINE_VERSION=3.23.5
ARG ELIXIR_VERSION=1.20.2
ARG ERLANG_VERSION=29.0.2
ARG NODE_VERSION=22.18.0
# --- Set up Elixir app builder
FROM hexpm/elixir:${ELIXIR_VERSION}-erlang-${ERLANG_VERSION}-alpine-${ALPINE_VERSION} AS elixir-builder
ENV MIX_ENV="prod"
WORKDIR /root
ADD . .
RUN apk add --update git make
RUN mix do local.hex --force, local.rebar --force
RUN mix do deps.get --only prod
# --- Build frontend assets
FROM node:${NODE_VERSION} AS assets-builder
WORKDIR /root
ADD . .
# copy in elixir deps, required to build node modules for phoenix
COPY --from=elixir-builder /root/deps ./deps
RUN npm --prefix assets ci
RUN npm --prefix assets run deploy
# --- Build final application
FROM elixir-builder AS app-builder
RUN apk add --update curl
ENV MIX_ENV="prod"
WORKDIR /root
RUN curl https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem -o aws-cert-bundle.pem -f
# add frontend assets built earlier, required by phx.digest
COPY --from=assets-builder /root/priv/static ./priv/static
RUN mix do compile --force, phx.digest, sentry.package_source_code, release
# --- Set up runtime container and copy built app into it
FROM hexpm/erlang:${ERLANG_VERSION}-alpine-${ALPINE_VERSION}
RUN apk add --update jq
ENV MIX_ENV="prod" PORT="4000"
WORKDIR /root
ADD . .
COPY --from=app-builder /root/priv/static ./priv/static
COPY --from=app-builder /root/_build/prod/rel/screens .
COPY --from=app-builder /root/aws-cert-bundle.pem ./priv/aws-cert-bundle.pem
CMD ["bin/screens", "start"]