# ---- Build stage ---- FROM hexpm/elixir:1.18.4-erlang-26.2.5.18-debian-bookworm-20260223-slim AS builder RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ git \ curl \ && 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 prod RUN mix deps.compile COPY config config COPY assets assets COPY priv priv COPY lib lib RUN mix assets.setup && mix assets.deploy RUN mix compile && mix release # ---- Runtime stage ---- FROM debian:bookworm-slim AS runtime RUN apt-get update && apt-get install -y --no-install-recommends \ libstdc++6 \ openssl \ libncurses5 \ locales \ ca-certificates \ && apt-get clean && rm -rf /var/lib/apt/lists/* RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen ENV LANG=en_US.UTF-8 WORKDIR /app RUN chown nobody /app COPY --from=builder --chown=nobody:root /app/_build/prod/rel/cobblemon_ui ./ USER nobody ENV PHX_SERVER=true EXPOSE 4000 CMD ["/app/bin/cobblemon_ui", "start"]