# Auto-generated by GitBlixt for Elixir/Phoenix apps ARG ELIXIR_VERSION=1.19.4 ARG OTP_VERSION=28.4.2 ARG DEBIAN_VERSION=trixie-20260518-slim ARG BUILDER_IMAGE="docker.io/hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}" ARG RUNNER_IMAGE="docker.io/debian:${DEBIAN_VERSION}" FROM ${BUILDER_IMAGE} AS builder RUN apt-get update \ && apt-get install -y --no-install-recommends build-essential git \ && rm -rf /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 RUN mix assets.setup COPY priv priv COPY lib lib RUN mix compile COPY assets assets RUN mix assets.deploy COPY config/runtime.exs config/ RUN mix release --overwrite # --- runner --- FROM ${RUNNER_IMAGE} AS final RUN apt-get update \ && apt-get install -y --no-install-recommends \ libstdc++6 openssl libncurses6 locales ca-certificates curl \ && sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \ && locale-gen \ && rm -rf /var/lib/apt/lists/* \ && sed -i 's/^tty:x:5:/tty:x:5:nobody/' /etc/group ENV LANG=en_US.UTF-8 ENV LANGUAGE=en_US:en ENV LC_ALL=en_US.UTF-8 ENV MIX_ENV="prod" ENV PHX_SERVER=true ENV PORT=4000 WORKDIR /app RUN chown nobody /app COPY --from=builder --chown=nobody:root /app/_build/prod/rel/ /tmp/rel/ RUN cp -a /tmp/rel/*/* ./ && rm -rf /tmp/rel USER nobody EXPOSE ${PORT} CMD sh -c "if [ -f /app/bin/server ]; then exec /app/bin/server; else exec /app/bin/$(ls /app/bin/ | grep -v '.bat' | head -1) start; fi"