Docker configure
This commit is contained in:
44
docker/Dockerfile
Normal file
44
docker/Dockerfile
Normal file
@@ -0,0 +1,44 @@
|
||||
# ============================================================
|
||||
# Этап 1: Сборка
|
||||
# ============================================================
|
||||
FROM erlang:28-alpine AS builder
|
||||
|
||||
RUN apk add --no-cache \
|
||||
git curl make gcc musl-dev \
|
||||
rust cargo openssl-dev libsodium-dev
|
||||
|
||||
WORKDIR /app
|
||||
COPY rebar.config ./
|
||||
RUN rebar3 lock || true
|
||||
RUN rebar3 get-deps
|
||||
|
||||
COPY include/ include/
|
||||
COPY src/ src/
|
||||
|
||||
# Копируем sys.config из src/config/ в config/
|
||||
COPY src/config/sys.config ./config/sys.config
|
||||
|
||||
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
|
||||
|
||||
# ============================================================
|
||||
# Этап 2: Финальный образ
|
||||
# ============================================================
|
||||
FROM alpine:3.20
|
||||
|
||||
RUN apk add --no-cache 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/
|
||||
|
||||
RUN mkdir -p /app/data && chmod 777 /app/data
|
||||
|
||||
WORKDIR /app
|
||||
EXPOSE 8080 8081 8445 8446
|
||||
|
||||
ENV RELX_REPLACE_OS_VARS=true
|
||||
ENV MNESIA_DIR=/app/data
|
||||
|
||||
CMD ["/app/bin/eventhub", "foreground"]
|
||||
Reference in New Issue
Block a user