-
Notifications
You must be signed in to change notification settings - Fork 18
/
Dockerfile
48 lines (32 loc) · 1.12 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
ARG ELIXIR_VERSION=1.17.3
ARG ERLANG_VERSION=27.2
ARG ALPINE_VERSION=3.21.0
FROM hexpm/elixir:${ELIXIR_VERSION}-erlang-${ERLANG_VERSION}-alpine-${ALPINE_VERSION} as builder
WORKDIR /root
# Install Hex+Rebar
RUN mix local.hex --force && \
mix local.rebar --force
RUN apk add --update git make build-base erlang-dev
ENV MIX_ENV=prod
ADD apps apps
ADD config config
ADD mix.* /root/
RUN mix do deps.get --only prod, phx.swagger.generate, compile, phx.digest
RUN mix eval "Application.ensure_all_started(:tzdata); Tzdata.DataBuilder.load_and_save_table()"
ADD rel/ rel/
RUN mix release
# The one the elixir image was built with
FROM alpine:${ALPINE_VERSION}
RUN apk add --no-cache libssl3 dumb-init libstdc++ libgcc ncurses-libs && \
mkdir /work /api && \
adduser -D api && chown api /work
COPY --from=builder /root/_build/prod/rel/api_web /api
# Set exposed ports
EXPOSE 4000
ENV PORT=4000 MIX_ENV=prod TERM=xterm LANG=C.UTF-8 \
ERL_CRASH_DUMP_SECONDS=0 RELEASE_TMP=/work
USER api
WORKDIR /work
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
HEALTHCHECK CMD ["/api/bin/api_web", "rpc", "1 + 1"]
CMD ["/api/bin/api_web", "start"]