-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
69 lines (50 loc) · 1.9 KB
/
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
62
63
64
65
66
67
68
69
# --- Set up Elixir build ---
ARG ELIXIR_VERSION=1.14.5
ARG ERLANG_VERSION=26.1.2
ARG DEBIAN_NAME=bullseye
ARG DEBIAN_VERSION=${DEBIAN_NAME}-20230612
ARG NODE_VERSION=18.14.0
FROM hexpm/elixir:${ELIXIR_VERSION}-erlang-${ERLANG_VERSION}-debian-${DEBIAN_VERSION}-slim as elixir-builder
ENV LANG=C.UTF-8 MIX_ENV=prod
RUN apt-get update --allow-releaseinfo-change
RUN apt-get install --no-install-recommends --yes \
build-essential ca-certificates git
RUN mix local.hex --force
RUN mix local.rebar --force
WORKDIR /root
ADD . .
RUN mix deps.get --only prod
# --- Build frontend assets ---
FROM node:${NODE_VERSION}-${DEBIAN_NAME}-slim as asset-builder
RUN apt-get update --allow-releaseinfo-change
RUN apt-get install --no-install-recommends --yes ca-certificates git
# Allow asset build to reference files provided by Elixir dependencies
WORKDIR /root
COPY --from=elixir-builder /root/deps ./deps
WORKDIR /root/apps/concierge_site/assets
ADD apps/concierge_site/assets .
RUN npm install
RUN npm run deploy
# --- Build Elixir release ---
FROM elixir-builder as app-builder
RUN apt-get install --no-install-recommends --yes curl
WORKDIR /root/apps/concierge_site/priv/static
COPY --from=asset-builder /root/apps/concierge_site/priv/static .
WORKDIR /root
RUN curl https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem \
-o aws-cert-bundle.pem
RUN mix compile
RUN mix phx.digest
RUN mix release
# --- Set up runtime container ---
FROM debian:${DEBIAN_NAME}-slim
ENV LANG=C.UTF-8 MIX_ENV=prod REPLACE_OS_VARS=true
RUN apt-get update --allow-releaseinfo-change \
&& apt-get install --no-install-recommends --yes dumb-init ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /root
COPY --from=app-builder /root/_build/prod/rel/alerts_concierge .
COPY --from=app-builder /root/aws-cert-bundle.pem ./priv/aws-cert-bundle.pem
EXPOSE 4000
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["bin/alerts_concierge", "start"]