guildhall/Dockerfile
Tyler J King 524c2f53b8 feat(docker): migrate to golden elixir-builder + elixir-runtime
Replace hexpm/elixir builder with substrate/elixir-builder:1.17.3
(pre-installed hex, rebar3, build-essential). Replace debian:bookworm-slim
runtime with substrate/elixir-runtime:latest (Wolfi base, ncurses,
libstdc++, openssl, UID 1000). Removes ~30 lines of apt-get and
user-creation boilerplate.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Tyler J King <tking@guildhouse.dev>
2026-05-16 09:05:30 -04:00

57 lines
1.7 KiB
Docker

# Guildhall production image — Elixir/Phoenix umbrella release.
# Multi-stage: builder produces a mix release; runtime is a slim debian
# carrying only the OTP release + runtime libs.
#
# Build context: the guildhall umbrella root.
# Target registry: git.guildhouse.dev/tking/guildhall:<tag>
# ---------- Stage 1: builder ---------------------------------------------
FROM git.guildhouse.dev/guildhouse/substrate/elixir-builder:1.17.3 AS builder
ENV MIX_ENV=prod \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8
WORKDIR /app
COPY mix.exs mix.lock ./
COPY config/config.exs config/prod.exs config/runtime.exs config/
COPY apps/guildhall_chronicle/mix.exs apps/guildhall_chronicle/
COPY apps/guildhall_graph_bridge/mix.exs apps/guildhall_graph_bridge/
COPY apps/guildhall_ops_db/mix.exs apps/guildhall_ops_db/
COPY apps/guildhall_orchestrator/mix.exs apps/guildhall_orchestrator/
COPY apps/guildhall_web/mix.exs apps/guildhall_web/
RUN mix deps.get --only prod && \
mix deps.compile
COPY apps/ apps/
COPY apps/guildhall_web/assets apps/guildhall_web/assets
RUN cd apps/guildhall_web && \
mix assets.setup && \
mix assets.deploy
RUN mix compile --warnings-as-errors && \
mix release --overwrite
# ---------- Stage 2: runtime (Wolfi — golden elixir-runtime) -------------
FROM git.guildhouse.dev/guildhouse/substrate/elixir-runtime:latest AS runtime
WORKDIR /app
COPY --from=builder --chown=substrate:substrate /app/_build/prod/rel/guildhall /app
USER 1000
ENV HOME=/app \
PHX_SERVER=true \
PORT=4000
EXPOSE 4000
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
CMD curl -fsS http://localhost:4000/health || exit 1
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/app/bin/guildhall", "start"]