Skip to content

Commit e042f6e

Browse files
committed
bootsnap
1 parent b5983df commit e042f6e

File tree

5 files changed

+12
-1
lines changed

5 files changed

+12
-1
lines changed

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,14 @@ COPY --from=builder /app/.bundle /app/.bundle
5151
COPY --from=builder /usr/local/bin/bundle /usr/local/bin/aws_lambda_ric /usr/local/bin
5252
COPY --from=nodebuilder /app/public/vite /app/public/vite
5353
COPY . /app/
54+
ENV BOOTSNAP_CACHE_DIR=/bootsnap
55+
RUN mkdir -p /bootsnap && bundle exec bootsnap precompile --gemfile app/ lib/ config/
56+
5457
COPY config/lambda_entrypoint.sh /lambda_entrypoint.sh
5558
COPY config/docker_entrypoint.sh /docker_entrypoint.sh
5659

5760
ENV PORT 3000
5861
ENV LANG C.UTF-8
62+
ENV BOOTSNAP_READONLY=1
5963
ENTRYPOINT ["/docker_entrypoint.sh"]
6064
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ gem 'apigatewayv2_rack'
4545

4646
gem 'open3', require: false
4747

48+
gem 'bootsnap', require: false
49+
4850
group :production do
4951
end
5052

Gemfile.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ GEM
109109
aws_lambda_ric (3.1.3)
110110
base64 (0.3.0)
111111
bigdecimal (3.3.1)
112+
bootsnap (1.19.0)
113+
msgpack (~> 1.2)
112114
builder (3.3.0)
113115
childprocess (5.1.0)
114116
logger (~> 1.5)
@@ -216,6 +218,7 @@ GEM
216218
mini_mime (1.1.5)
217219
mini_portile2 (2.8.9)
218220
minitest (5.26.1)
221+
msgpack (1.8.0)
219222
multi_xml (0.7.2)
220223
bigdecimal (~> 3.1)
221224
multipart-post (2.4.1)
@@ -419,6 +422,7 @@ DEPENDENCIES
419422
aws-sdk-sqs
420423
aws-sdk-ssm
421424
aws_lambda_ric
425+
bootsnap
422426
commonmarker
423427
connection_pool
424428
factory_bot_rails

config/boot.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
require "bundler/setup" # Set up gems listed in the Gemfile.
44

5+
require 'bootsnap/setup'
56
require_relative 'lambda_boot' if ENV['AWS_LAMBDA_FUNCTION_NAME']

config/environments/development.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
config.enable_reloading = true
1010

1111
# Do not eager load code on boot.
12-
config.eager_load = false
12+
config.eager_load = ENV['EAGER_LOAD'] == '1'
1313

1414
# Show full error reports.
1515
config.consider_all_requests_local = true

0 commit comments

Comments
 (0)