Skip to content

Commit

Permalink
Updates Dockerfile.template to add jemalloc
Browse files Browse the repository at this point in the history
Adapts the debian support from bv-ruby and adds support for alpine which
seems straightforward now with the native package.
  • Loading branch information
chrishulton committed Oct 18, 2024
1 parent 4e09dcf commit d60aac2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ FROM debian:{{ env.variant | ltrimstr("slim-") }}-slim
{{ ) else ( -}}
FROM buildpack-deps:{{ env.variant }}
{{ ) end -}}
LABEL maintainer="Chris Hulton <chulton@ltvco.com>, Patrick Tulskie <patrick@ltvco.com>"

{{ if is_alpine then ( -}}
RUN set -eux; \
apk add --no-cache \
bzip2 \
ca-certificates \
gmp-dev \
jemalloc-dev \
libffi-dev \
procps \
yaml-dev \
Expand All @@ -33,11 +35,13 @@ RUN set -eux; \
ca-certificates \
libffi-dev \
libgmp-dev \
libjemalloc-dev \
libssl-dev \
libyaml-dev \
procps \
zlib1g-dev \
; \
apt-mark hold libjemalloc-dev; \
rm -rf /var/lib/apt/lists/*

{{ ) else "" end -}}
Expand Down Expand Up @@ -234,6 +238,7 @@ RUN set -eux; \
--build="$gnuArch" \
--disable-install-doc \
--enable-shared \
--with-jemalloc \
{{ if .rust.version then ( -}}
${rustArch:+--enable-yjit} \
{{ ) else "" end -}}
Expand Down Expand Up @@ -285,7 +290,8 @@ RUN set -eux; \
# rough smoke test
ruby --version; \
gem --version; \
bundle --version
bundle --version; \
ruby -r rbconfig -e "RbConfig::CONFIG['MAINLIBS'].include?('jemalloc') ? puts('Ruby is compiled with jemalloc') : warn('JEMALLOC IS MISSING FROM RUBY')"

# don't create ".bundle" in all our apps
ENV GEM_HOME /usr/local/bundle
Expand Down

0 comments on commit d60aac2

Please sign in to comment.