-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
55 lines (38 loc) · 1.62 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
# first, get the elixir dependencies within an elixir container
FROM hexpm/elixir:1.14.5-erlang-26.0.2-debian-buster-20240513-slim as elixir-builder
ENV LANG="C.UTF-8" MIX_ENV="prod"
WORKDIR /root
ADD . .
# Install git so we can install dependencies from GitHub
RUN apt-get update --allow-releaseinfo-change && \
apt-get install -y --no-install-recommends git ca-certificates
RUN mix do local.hex --force, local.rebar --force, deps.get --only prod
# next, build the frontend assets within a node.js container
FROM node:18.12.1 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 ci --prefix assets && npm run deploy --prefix assets
# now, build the application back in the elixir container
FROM elixir-builder as app-builder
WORKDIR /root
# add frontend assets compiled in node container, required by phx.digest
COPY --from=assets-builder /root/priv/static ./priv/static
RUN mix do compile --force, phx.digest, release
# the one the elixir image was built with
FROM debian:buster
RUN apt-get update --allow-releaseinfo-change && \
apt-get install -y --no-install-recommends libssl1.1 libsctp1 curl ca-certificates && \
rm -rf /var/lib/apt/lists/*
WORKDIR /root
EXPOSE 4000
ENV MIX_ENV=prod TERM=xterm LANG="C.UTF-8" PORT=4000
# add frontend assets with manifests from app build container
COPY --from=app-builder /root/priv/static ./priv/static
COPY --from=app-builder /root/_build/prod/rel/signs_ui .
RUN mkdir gtfs
# Healthcheck
HEALTHCHECK CMD ["bin/signs_ui", "rpc", "1 + 1"]
# Start application
CMD ["bin/signs_ui", "start"]