Files
aleksey cd61aaff20 feat: bake product version from Spec and expose build in health.
Resolve MAJOR.MINOR via EventHubSpec/VERSION; CI run_number as EVENTHUB_BUILD; health returns version/build/git_sha/built_at.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 21:48:24 +03:00

61 lines
2.0 KiB
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# EventHub production image (multi-stage).
# Требует erlang-builder / erlang-runtime — см. scripts/build-erlang-base-images.sh
ARG ERLANG_BUILDER_IMAGE=git.sabilin.com/eventhub/erlang-builder:latest
ARG ERLANG_RUNTIME_IMAGE=git.sabilin.com/eventhub/erlang-runtime:latest
# ============================================================
# Этап 1: Сборка
# ============================================================
FROM ${ERLANG_BUILDER_IMAGE} AS builder
WORKDIR /app
COPY rebar.config ./
RUN rebar3 lock || true
RUN rebar3 get-deps
COPY include/ include/
COPY src/ src/
COPY src/config/sys.config ./config/sys.config
COPY src/config/vm.args ./config/vm.args
COPY docker/scripts/collect-runtime-libs.sh /usr/local/bin/collect-runtime-libs.sh
RUN chmod +x /usr/local/bin/collect-runtime-libs.sh
RUN rebar3 as prod release
RUN rebar3 as prod tar
RUN mkdir -p /app/release && \
tar -xzf _build/prod/rel/eventhub/eventhub-*.tar.gz -C /app/release
# NIF (argon2 → libsodium/openssl): ldd + копия .so с builder (ABI = Alpine builder)
RUN collect-runtime-libs.sh /app/release /opt/runtime-libs
# ============================================================
# Этап 2: Финальный образ
# ============================================================
FROM ${ERLANG_RUNTIME_IMAGE}
ARG EVENTHUB_VERSION=0.0
ARG EVENTHUB_BUILD=0
ARG EVENTHUB_GIT_SHA=unknown
ARG EVENTHUB_BUILT_AT=
ENV EVENTHUB_VERSION=${EVENTHUB_VERSION} \
EVENTHUB_BUILD=${EVENTHUB_BUILD} \
EVENTHUB_GIT_SHA=${EVENTHUB_GIT_SHA} \
EVENTHUB_BUILT_AT=${EVENTHUB_BUILT_AT}
COPY --from=builder /app/release /app
# Доп. .so, если версия apk-openssl на runtime не совпала с builder (страховка)
COPY --from=builder /opt/runtime-libs/ /
COPY docker/scripts/verify-native-libs.sh /usr/local/bin/verify-native-libs.sh
RUN chmod +x /usr/local/bin/verify-native-libs.sh \
&& verify-native-libs.sh /app
EXPOSE 8080 8081 8445 8446
ENV RELX_REPLACE_OS_VARS=true
CMD ["/app/bin/eventhub", "foreground"]