-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
50 lines (46 loc) · 1.41 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
# syntax=docker/dockerfile:1
ARG SRC_DIR=/src
# ---- dev stage ----
ARG ALPINE_LINUX_VERSION=3.18.2
ARG ELIXIR_VERSION=1.15.4
ARG ERLANG_VERSION=26.0.2
FROM hexpm/elixir:$ELIXIR_VERSION-erlang-$ERLANG_VERSION-alpine-$ALPINE_LINUX_VERSION AS dev
RUN mix do local.hex --force, local.rebar --force
RUN apk add --no-cache \
# required by hex:phoenix_live_reload \
inotify-tools
COPY container/trapped-mix /usr/local/bin/trapped-mix
# ---- build stage ----
FROM elixir:1.15.4 AS builder
ARG SRC_DIR
RUN apt-get update -y && apt-get install -y build-essential git \
&& apt-get clean && rm -f /var/lib/apt/lists/*_*
RUN mix local.rebar --force \
&& mix local.hex --force
ENV MIX_ENV=prod
WORKDIR $SRC_DIR
COPY mix.exs mix.lock ./
RUN mix deps.get --only $MIX_ENV
RUN mkdir config
COPY config/config.exs config/$MIX_ENV.exs config/
RUN mix deps.compile
COPY priv priv
COPY lib lib
RUN mix compile
COPY config/runtime.exs config/
# COPY rel rel
RUN mix release
# ---- app stage ----
FROM debian:bullseye-slim
ARG SRC_DIR
RUN apt-get update -y && apt-get install -y libstdc++6 openssl libncurses5 locales \
&& apt-get clean && rm -f /var/lib/apt/lists/*_*
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
WORKDIR "/app"
RUN chown nobody /app
COPY --from=builder --chown=nobody:root $SRC_DIR/_build/prod/rel/dash ./
USER nobody
CMD /app/bin/dash start