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>
This commit is contained in:
+19
-22
@@ -1,12 +1,12 @@
|
||||
# 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:28-alpine AS builder
|
||||
|
||||
# RUN apk add --no-cache \
|
||||
RUN apk add \
|
||||
git curl make gcc musl-dev \
|
||||
rust cargo openssl-dev libsodium-dev
|
||||
FROM ${ERLANG_BUILDER_IMAGE} AS builder
|
||||
|
||||
WORKDIR /app
|
||||
COPY rebar.config ./
|
||||
@@ -16,38 +16,35 @@ RUN rebar3 get-deps
|
||||
COPY include/ include/
|
||||
COPY src/ src/
|
||||
|
||||
# Копируем sys.config из src/config/ в config/
|
||||
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 alpine:3.20
|
||||
FROM ${ERLANG_RUNTIME_IMAGE}
|
||||
|
||||
# RUN apk add --no-cache \
|
||||
RUN apk add \
|
||||
openssl libstdc++ libgcc ncurses-libs libsodium
|
||||
COPY --from=builder /app/release /app
|
||||
COPY --from=builder /usr/lib/libcrypto.* /usr/lib/
|
||||
COPY --from=builder /usr/lib/libssl.* /usr/lib/
|
||||
# Доп. .so, если версия apk-openssl на runtime не совпала с builder (страховка)
|
||||
COPY --from=builder /opt/runtime-libs/ /
|
||||
|
||||
RUN mkdir -p /app/data && chmod 777 /app/data
|
||||
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
|
||||
|
||||
WORKDIR /app
|
||||
EXPOSE 8080 8081 8445 8446
|
||||
|
||||
ENV PATH="/app/erts-16.3.1/bin:$PATH"
|
||||
|
||||
ENV RELX_REPLACE_OS_VARS=true
|
||||
|
||||
CMD /app/bin/eventhub foreground
|
||||
# COPY docker/entrypoint.sh /app/entrypoint.sh
|
||||
# RUN chmod +x /app/entrypoint.sh
|
||||
#
|
||||
# ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
CMD ["/app/bin/eventhub", "foreground"]
|
||||
|
||||
Reference in New Issue
Block a user