File tree Expand file tree Collapse file tree 2 files changed +4
-8
lines changed
railties/lib/rails/generators/rails/app/templates Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -17,13 +17,15 @@ WORKDIR /rails
17
17
# Install base packages
18
18
RUN apt-get update -qq && \
19
19
apt-get install --no-install-recommends -y <%= dockerfile_base_packages.join(" ") %> && \
20
+ ln -s /usr/lib/$(uname -m)-linux-gnu/libjemalloc.so.2 /usr/local/lib/libjemalloc.so && \
20
21
rm -rf /var/lib/apt/lists /var/cache/apt/archives
21
22
22
- # Set production environment
23
+ # Set production environment variables and enable jemalloc for reduced memory usage and latency.
23
24
ENV RAILS_ENV="production" \
24
25
BUNDLE_DEPLOYMENT="1" \
25
26
BUNDLE_PATH="/usr/local/bundle" \
26
- BUNDLE_WITHOUT="development"
27
+ BUNDLE_WITHOUT="development" \
28
+ LD_PRELOAD=/usr/local/lib/libjemalloc.so
27
29
28
30
# Throw-away build stage to reduce size of final image
29
31
FROM base AS build
Original file line number Diff line number Diff line change 1
1
#! /bin/bash -e
2
2
3
- # Enable jemalloc for reduced memory usage and latency.
4
- if [ -z " ${LD_PRELOAD+x} " ]; then
5
- LD_PRELOAD=$( find /usr/lib -name libjemalloc.so.2 -print -quit)
6
- export LD_PRELOAD
7
- fi
8
-
9
3
< % unless skip_active_record? -%>
10
4
# If running the rails server then create or migrate existing database
11
5
if [ " ${@: -2: 1} " == " ./bin/rails" ] && [ " ${@: -1: 1} " == " server" ]; then
You can’t perform that action at this time.
0 commit comments