From 99b33457be194bcbc1ca2056be54183240c5aea2 Mon Sep 17 00:00:00 2001 From: Philip Jenvey Date: Thu, 4 Jan 2018 15:42:21 -0800 Subject: [PATCH] feat: allow optional use of jemalloc via USE_JEMALLOC which defaults to false Closes #1100 (cherry picked from commit 0ba6603205ecbdc69d808fd7bab3d513dfbfff85) --- Dockerfile | 4 +++- entrypoint.sh | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index fa35388a..c171bf48 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,16 +2,18 @@ FROM pypy:2-5.9.0 RUN mkdir -p /app ADD . /app +RUN chmod +x /app/entrypoint.sh WORKDIR /app ENV PATH=$PATH:/root/.cargo/bin RUN \ apt-get update && \ - apt-get install -y -qq libexpat1-dev gcc libssl-dev libffi-dev && \ + apt-get install -y -qq libexpat1-dev gcc libssl-dev libffi-dev libjemalloc1 && \ curl https://sh.rustup.rs | sh -s -- -y && \ make clean && \ pip install -r requirements.txt && \ pypy setup.py develop +ENTRYPOINT ["/app/entrypoint.sh"] CMD ["autopush"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 00000000..43bb9926 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ "${USE_JEMALLOC:-false}" = "true" ]; then + export LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libjemalloc.so.1" +fi + +exec "$@"