Skip to content

Commit

Permalink
feat(docker): Add support for arm64 and amd64 builds for jemalloc
Browse files Browse the repository at this point in the history
  • Loading branch information
muXxer committed Dec 20, 2024
1 parent 78f337f commit c2ec252
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 12 deletions.
16 changes: 13 additions & 3 deletions docker/iota-bridge-indexer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,19 @@ WORKDIR "$WORKDIR"
# Install runtime dependencies and tools
RUN apt update && apt install -y libpq5 ca-certificates curl

# Install jemalloc as the default allocator
RUN apt install -y libjemalloc-dev
ENV LD_PRELOAD /usr/lib/x86_64-linux-gnu/libjemalloc.so
# Install jemalloc as the default allocator used for memory profiling on supported
# architectures and create a symlink for the correct version based on the architecture
RUN ARCH=$(dpkg --print-architecture) && \
if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "arm64" ]; then \
apt update && apt install -y libjemalloc-dev; \
ln -sf $(ldconfig -p | grep jemalloc | awk '{print $4}' | sort -u | head -n 1) /usr/lib/libjemalloc.so; \
else \
echo "Unsupported architecture: $ARCH. Only amd64 and arm64 are supported."; \
exit 1; \
fi

# Set LD_PRELOAD to the symlinked path
ENV LD_PRELOAD=/usr/lib/libjemalloc.so

COPY --from=builder /iota/bridge-indexer /usr/local/bin

Expand Down
16 changes: 13 additions & 3 deletions docker/iota-indexer-tidb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,19 @@ WORKDIR "$WORKDIR"
# Install runtime dependencies and tools
RUN apt update && apt install -y libpq5 ca-certificates curl

# Install jemalloc as the default allocator
RUN apt install -y libjemalloc-dev
ENV LD_PRELOAD /usr/lib/x86_64-linux-gnu/libjemalloc.so
# Install jemalloc as the default allocator used for memory profiling on supported
# architectures and create a symlink for the correct version based on the architecture
RUN ARCH=$(dpkg --print-architecture) && \
if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "arm64" ]; then \
apt update && apt install -y libjemalloc-dev; \
ln -sf $(ldconfig -p | grep jemalloc | awk '{print $4}' | sort -u | head -n 1) /usr/lib/libjemalloc.so; \
else \
echo "Unsupported architecture: $ARCH. Only amd64 and arm64 are supported."; \
exit 1; \
fi

# Set LD_PRELOAD to the symlinked path
ENV LD_PRELOAD=/usr/lib/libjemalloc.so

COPY --from=builder /iota/iota-indexer /usr/local/bin

Expand Down
16 changes: 13 additions & 3 deletions docker/iota-indexer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,19 @@ WORKDIR "$WORKDIR"
# Install runtime dependencies and tools
RUN apt update && apt install -y libpq5 ca-certificates curl

# Install jemalloc as the default allocator
RUN apt install -y libjemalloc-dev
ENV LD_PRELOAD /usr/lib/x86_64-linux-gnu/libjemalloc.so
# Install jemalloc as the default allocator used for memory profiling on supported
# architectures and create a symlink for the correct version based on the architecture
RUN ARCH=$(dpkg --print-architecture) && \
if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "arm64" ]; then \
apt update && apt install -y libjemalloc-dev; \
ln -sf $(ldconfig -p | grep jemalloc | awk '{print $4}' | sort -u | head -n 1) /usr/lib/libjemalloc.so; \
else \
echo "Unsupported architecture: $ARCH. Only amd64 and arm64 are supported."; \
exit 1; \
fi

# Set LD_PRELOAD to the symlinked path
ENV LD_PRELOAD=/usr/lib/libjemalloc.so

COPY --from=builder /iota/iota-indexer /usr/local/bin

Expand Down
16 changes: 13 additions & 3 deletions docker/iota-node/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,19 @@ WORKDIR "$WORKDIR"
# Install runtime dependencies and tools
RUN apt update && apt install -y libpq5 ca-certificates curl

# Install jemalloc as the default allocator
RUN apt install -y libjemalloc-dev
ENV LD_PRELOAD /usr/lib/x86_64-linux-gnu/libjemalloc.so
# Install jemalloc as the default allocator used for memory profiling on supported
# architectures and create a symlink for the correct version based on the architecture
RUN ARCH=$(dpkg --print-architecture) && \
if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "arm64" ]; then \
apt update && apt install -y libjemalloc-dev; \
ln -sf $(ldconfig -p | grep jemalloc | awk '{print $4}' | sort -u | head -n 1) /usr/lib/libjemalloc.so; \
else \
echo "Unsupported architecture: $ARCH. Only amd64 and arm64 are supported."; \
exit 1; \
fi

# Set LD_PRELOAD to the symlinked path
ENV LD_PRELOAD=/usr/lib/libjemalloc.so

COPY --from=builder /iota/iota-node /usr/local/bin

Expand Down

0 comments on commit c2ec252

Please sign in to comment.