|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ARG ELIXIR_VERSION=1.16.1 |
|
ARG OTP_VERSION=26.2.1 |
|
ARG DEBIAN_VERSION=bullseye-20231009-slim |
|
|
|
ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}" |
|
ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}" |
|
|
|
FROM ${BUILDER_IMAGE} as builder |
|
|
|
|
|
RUN apt-get update -y && apt-get install -y build-essential git curl \ |
|
libasound2-dev portaudio19-dev \ |
|
libportaudio2 libportaudiocpp0 \ |
|
&& apt-get clean && rm -f /var/lib/apt/lists/*_* |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
RUN mix local.hex --force && \ |
|
mix local.rebar --force |
|
|
|
|
|
ENV MIX_ENV="prod" |
|
|
|
|
|
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 |
|
|
|
COPY assets assets |
|
|
|
|
|
|
|
|
|
RUN mix assets.deploy |
|
|
|
|
|
RUN mix compile |
|
|
|
|
|
COPY config/runtime.exs config/ |
|
|
|
COPY rel rel |
|
RUN mix release |
|
|
|
|
|
|
|
FROM ${RUNNER_IMAGE} |
|
|
|
RUN apt-get update -y && \ |
|
apt-get install -y libstdc++6 openssl libncurses5 locales ca-certificates curl unzip \ |
|
&& apt-get clean && rm -f /var/lib/apt/lists/*_* |
|
|
|
RUN apt-get update -y && \ |
|
apt-get install -y postgresql-client \ |
|
&& apt-get clean && rm -f /var/lib/apt/lists/*_* |
|
|
|
|
|
RUN apt-get update -y && \ |
|
apt-get install -y ffmpeg libasound2-dev portaudio19-dev \ |
|
&& apt-get clean && rm -f /var/lib/apt/lists/*_* |
|
|
|
|
|
RUN apt-get update -y && \ |
|
apt-get install -y fonts-liberation libatk-bridge2.0-0 libatk1.0-0 \ |
|
libatspi2.0-0 libcups2 libgtk-3-0 libnspr4 libnss3 libu2f-udev libxcomposite1 wget xdg-utils \ |
|
&& apt-get clean && rm -f /var/lib/apt/lists/*_* |
|
|
|
|
|
RUN curl -LO https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb |
|
RUN apt-get install -y ./google-chrome-stable_current_amd64.deb \ |
|
&& apt-get clean && rm -f ./google-chrome-stable_current_amd64.deb |
|
|
|
|
|
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 |
|
|
|
|
|
ENV MIX_ENV="prod" |
|
|
|
|
|
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/medicode ./ |
|
|
|
USER nobody |
|
|
|
|
|
|
|
|
|
|
|
|
|
CMD ["/app/bin/server"] |
|
|