portal/Dockerfile
Mikael Hugo a3622f29ef feat: elixir 1.20-rc4 flake, AI ops chat (ChatLive + RouterAgent)
- flake.nix: custom elixir_1_20_rc4 derivation via overrideAttrs on
  beamPackages.elixir_1_19 with headless OTP 28; nixos-25.11 pinned
- mix.exs (ops + my): elixir ~> 1.20
- Dockerfile: note 1.19.5 stays until hexpm publishes 1.20 stable image
- New: ChatLive — full-screen AI ops chat with SSE streaming, scroll hook,
  suggestion buttons, typing indicator, clear history
- New: RouterAgent — streams OpenAI-compatible SSE from router-agent svc;
  configurable URL + API key via env; sends {:chunk,t}/:stream_done msgs to LiveView
- Router: add live /chat route under auth pipeline
- Layouts: AI Chat nav link + ScrollBottom JS hook inline
- Application: Finch pool started for RouterAgent HTTP client
- Priv/static: phoenix.min.js + phoenix_live_view.min.js bundled
- Config: ROUTER_AGENT_URL / ROUTER_AGENT_API_KEY in dev.exs + runtime.exs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-11 11:23:14 +02:00

54 lines
1.5 KiB
Docker

# Build image — stays at 1.19.5 until hexpm publishes 1.20.0 stable image.
# Dev shell uses 1.20.0-rc.4 via flake.nix.
FROM hexpm/elixir:1.19.5-erlang-28.3.1-debian-trixie-20260202-slim AS build
RUN apt-get update -y && apt-get install -y --no-install-recommends \
build-essential git npm ca-certificates \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /app
ENV MIX_ENV=prod
RUN mix local.hex --force && mix local.rebar --force
# Umbrella root deps
COPY mix.exs mix.lock ./
COPY apps/centralcloud_core/mix.exs ./apps/centralcloud_core/
COPY apps/centralcloud_my/mix.exs ./apps/centralcloud_my/
COPY apps/centralcloud_ops/mix.exs ./apps/centralcloud_ops/
RUN mix deps.get --only prod && mix deps.compile
COPY config ./config
COPY apps/centralcloud_core ./apps/centralcloud_core
COPY apps/centralcloud_my ./apps/centralcloud_my
RUN mix compile
# Build release for centralcloud_my only
COPY rel ./rel
RUN mix release centralcloud_my
FROM debian:trixie-slim AS app
RUN apt-get update -y && apt-get install -y --no-install-recommends \
libstdc++6 openssl libncurses6 locales ca-certificates \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
RUN useradd --create-home --shell /bin/sh app
WORKDIR /app
RUN chown app:app /app
USER app
COPY --from=build --chown=app:app /app/_build/prod/rel/centralcloud_my ./
# Convenience symlink for migrate init container
RUN ln -s /app/bin/centralcloud_my /app/bin/migrate || true
ENV HOME=/app
ENV PHX_SERVER=true
CMD ["/app/bin/server"]