Skip to content

Commit

Permalink
Add TCMALLOC option to build of rocksdb
Browse files Browse the repository at this point in the history
  • Loading branch information
martinboehm committed Feb 18, 2021
1 parent 3fe28d1 commit 212b767
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ BIN_IMAGE = blockbook-build
DEB_IMAGE = blockbook-build-deb
PACKAGER = $(shell id -u):$(shell id -g)
NO_CACHE = false
TCMALLOC =
ARGS ?=

TARGETS=$(subst .json,, $(shell ls configs/coins))
Expand Down Expand Up @@ -44,7 +45,7 @@ build-images: clean-images
.bin-image:
@if [ $$(build/tools/image_status.sh $(BIN_IMAGE):latest build/docker) != "ok" ]; then \
echo "Building image $(BIN_IMAGE)..."; \
docker build --no-cache=$(NO_CACHE) -t $(BIN_IMAGE) build/docker/bin; \
docker build --no-cache=$(NO_CACHE) --build-arg TCMALLOC=$(TCMALLOC) -t $(BIN_IMAGE) build/docker/bin; \
else \
echo "Image $(BIN_IMAGE) is up to date"; \
fi
Expand Down
7 changes: 7 additions & 0 deletions build/docker/bin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@ ENV GOPATH=/go
ENV PATH=$PATH:$GOPATH/bin
ENV CGO_CFLAGS="-I/opt/rocksdb/include"
ENV CGO_LDFLAGS="-L/opt/rocksdb -ldl -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy -llz4"
ARG TCMALLOC

RUN mkdir /build

RUN if [ -n "${TCMALLOC}" ]; then \
echo "Using TCMALLOC"; \
apt-get install -y google-perftools; \
ln -s /usr/lib/libtcmalloc.so.4 /usr/lib/libtcmalloc.so;\
fi

# install and configure go
RUN cd /opt && wget https://dl.google.com/go/$GOLANG_VERSION.tar.gz && \
tar xf $GOLANG_VERSION.tar.gz
Expand Down

0 comments on commit 212b767

Please sign in to comment.