From 212b767925663eeb93715961a89b8efcbab3713d Mon Sep 17 00:00:00 2001 From: Martin Boehm Date: Wed, 17 Feb 2021 13:30:19 +0100 Subject: [PATCH] Add TCMALLOC option to build of rocksdb --- Makefile | 3 ++- build/docker/bin/Dockerfile | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5cc8c0eb..e97c0f16 100644 --- a/Makefile +++ b/Makefile @@ -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)) @@ -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 diff --git a/build/docker/bin/Dockerfile b/build/docker/bin/Dockerfile index b6b4aa05..122028af 100644 --- a/build/docker/bin/Dockerfile +++ b/build/docker/bin/Dockerfile @@ -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