From 8c6fb41933db25597e1af71dcf37befddc5f9ec5 Mon Sep 17 00:00:00 2001 From: Earlopain Date: Thu, 21 Apr 2022 20:22:15 +0200 Subject: [PATCH] [Docker] Use jemalloc It's used in prod, should be done here too then. Alpine doesn't provide this package, so we'll need to compile it ourself. Confirmed working with `MALLOC_CONF=stats_print:true ruby -e "exit"` --- Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3c6853751..42da59db5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,13 @@ FROM ruby:2.7.3-alpine RUN apk --no-cache add nodejs yarn postgresql-client ffmpeg vips tzdata \ git build-base postgresql-dev glib-dev -# Nice to have packages -RUN apk --no-cache add nano sudo bash +RUN wget -O - https://github.com/jemalloc/jemalloc/releases/download/5.2.1/jemalloc-5.2.1.tar.bz2 | tar -xj && \ + cd jemalloc-5.2.1 && \ + ./configure && \ + make && \ + make install + +ENV LD_PRELOAD=/usr/local/lib/libjemalloc.so.2 # Install js packages and gems COPY package.json yarn.lock ./