Files
EventHubBack/docker/Dockerfile
T
aleksey e8464b3a8b
CI / test (push) Successful in 7m42s
Add shared Erlang builder/runtime base images from registry.
Publish erlang-builder and erlang-runtime as :latest, use them in prod and API test builds, auto-collect NIF libs, and sync CI to pull/push bases before eventhub build.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-11 12:25:42 +03:00

51 lines
1.7 KiB
Docker
Raw 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}
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"]