Skip to content

Commit

Permalink
Install jemalloc via apt package and configure ruby to use transparently
Browse files Browse the repository at this point in the history
See docker-library/ruby#182 for more details.
  • Loading branch information
clekstro committed Feb 27, 2020
1 parent b163c1c commit 895ebf5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ LABEL maintainer Travis CI GmbH <support+travis-api-docker-images@travis-ci.com>
# packages required for bundle install
RUN ( \
apt-get update ; \
apt-get install -y --no-install-recommends git make gcc g++ libpq-dev \
apt-get install -y --no-install-recommends git make gcc g++ libpq-dev libjemalloc-dev \
&& rm -rf /var/lib/apt/lists/* \
)

ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2

# throw errors if Gemfile has been modified since Gemfile.lock
RUN bundle config --global frozen 1
RUN bundle config set deployment 'true'
Expand Down
4 changes: 2 additions & 2 deletions Procfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
web: ./script/server-buildpacks
console: jemalloc.sh bundle exec ./script/console
cron: jemalloc.sh bundle exec ./bin/cron
console: bundle exec ./script/console
cron: bundle exec ./bin/cron
4 changes: 2 additions & 2 deletions script/server
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ cmd="unicorn config.ru -E $RACK_ENV -c config/unicorn.rb"
[[ $RACK_ENV == "development" ]] && cmd="rerun -b -- $cmd"

if [ -z "$DYNO" ]; then
cmd="jemalloc.sh bundle exec $cmd"
cmd="bundle exec $cmd"
else
cmd="jemalloc.sh bin/start-nginx $cmd"
cmd="bin/start-nginx $cmd"
fi

exec $cmd

0 comments on commit 895ebf5

Please sign in to comment.