Skip to content

Commit

Permalink
Add jemalloc and use it including yjit, frozen_string in Dockerfile
Browse files Browse the repository at this point in the history
Use `exec` in entrypoint.sh
ericproulx committed Sep 1, 2024
1 parent 12dc739 commit 26a2742
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
ARG RUBY_VERSION
FROM ruby:$RUBY_VERSION-alpine
ARG RUBY_VERSION=3
FROM ruby:${RUBY_VERSION}-alpine

ENV BUNDLE_PATH /usr/local/bundle/gems
ENV LIB_PATH /var/grape
ENV RUBYOPT --enable-frozen-string-literal --yjit
ENV LD_PRELOAD libjemalloc.so.2
ENV MALLOC_CONF dirty_decay_ms:1000,narenas:2,background_thread:true

RUN apk add --update --no-cache make gcc git libc-dev gcompat && \
RUN apk add --update --no-cache make gcc git libc-dev gcompat jemalloc && \
gem update --system && gem install bundler

WORKDIR $LIB_PATH
2 changes: 1 addition & 1 deletion docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -13,4 +13,4 @@ else
fi

# Keep gems in the latest possible state
(bundle check || bundle install) && bundle update && bundle exec ${@}
(bundle check || bundle install) && bundle update && exec bundle exec ${@}

0 comments on commit 26a2742

Please sign in to comment.