diff --git a/config/initializers/shrine.rb b/config/initializers/shrine.rb index 57048e9d9..078735054 100644 --- a/config/initializers/shrine.rb +++ b/config/initializers/shrine.rb @@ -11,12 +11,15 @@ nil # migrations probably haven't run yet to create library table end - begin - Sidekiq::Cron::Job.create( - name: "clear-shrine-cache", - cron: "every hour", - class: "CacheSweepJob" - ) - rescue RedisClient::CannotConnectError + unless ENV.fetch("PREPARE_APP", nil) + begin + Sidekiq::Cron::Job.create( + name: "clear-shrine-cache", + cron: "every hour", + class: "CacheSweepJob" + ) + rescue + RedisClient::CannotConnectError + end end end diff --git a/config/initializers/usage_reports.rb b/config/initializers/usage_reports.rb index 776bba136..c1f24abf0 100644 --- a/config/initializers/usage_reports.rb +++ b/config/initializers/usage_reports.rb @@ -2,6 +2,6 @@ Rails.application.config.after_initialize do # Make sure the schedule is loaded correctly - UsageReport.set_schedule! + UsageReport.set_schedule! unless ENV.fetch("PREPARE_APP", nil) rescue RedisClient::CannotConnectError end diff --git a/docker/build.dockerfile b/docker/build.dockerfile index baeb80f5c..c858f0439 100644 --- a/docker/build.dockerfile +++ b/docker/build.dockerfile @@ -27,4 +27,5 @@ RUN \ DATABASE_URL="nulldb://user:pass@localhost/db" \ SECRET_KEY_BASE="placeholder" \ RACK_ENV="production" \ + PREPARE_APP="true" \ bundle exec rake assets:precompile