Skip to content

Commit b354690

Browse files
authored
Fix ActionView::Template::Error occurring in Sidekiq worker (#142)
2 parents 1f5a2c2 + 1285012 commit b354690

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

services/backend/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ RUN bundle install || exit 1
5959
RUN npm install
6060
RUN npm run build
6161

62+
# Precompile assets - use dummy secret key base and nulldb adapter to avoid database connection
63+
RUN SECRET_KEY_BASE=precompile_placeholder \
64+
DATABASE_URL="nulldb://localhost/precompile" \
65+
bundle exec rails assets:precompile
66+
6267
EXPOSE 4000
6368

6469
CMD ["/bin/bash", "-c", "rm -f /app/tmp/pids/server.pid && bundle exec rails s -b 0.0.0.0 -p 4000"]

services/backend/config/environments/production.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
config.assets.precompile += %w[ spree/backend/all.js spree/backend/all.css ]
3535

3636
# Do not fallback to assets pipeline if a precompiled asset is missed.
37-
config.assets.compile = true
37+
# Assets are precompiled during Docker build - disable runtime compilation
38+
# to prevent ExecJS errors in Sidekiq workers
39+
config.assets.compile = false
3840

3941
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
4042
# config.action_controller.asset_host = 'http://assets.example.com'

0 commit comments

Comments
 (0)