diff --git a/Dockerfile b/Dockerfile index 933db834..0791f7f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -54,6 +54,8 @@ RUN RAILS_ENV=production \ SECRET_KEY_BASE=dummy \ RAILS_MASTER_KEY=dummy \ DB_ADAPTER=nulldb \ + ASSETS_PRECOMPILE=true \ + STORAGE_PROVIDER=local \ bundle exec rails assets:precompile RUN mv config/credentials.yml.enc.bak config/credentials.yml.enc 2>/dev/null || true @@ -97,4 +99,4 @@ HEALTHCHECK --interval=1m --timeout=5s --start-period=10s \ ENTRYPOINT ["/app/entrypoint.sh"] -CMD ["/usr/bin/supervisord"] \ No newline at end of file +CMD ["/usr/bin/supervisord"] diff --git a/Gemfile b/Gemfile index df01fbed..c77b86bc 100644 --- a/Gemfile +++ b/Gemfile @@ -34,7 +34,7 @@ gem 'select2-rails', '~> 4.0.13' group :production do # we are using an ExecJS runtime only on the precompilation phase - gem "uglifier", "~> 4.2.0", require: false + gem "terser", "~> 1.2", require: false end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 03a2a8c5..3dbc6808 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -455,6 +455,8 @@ GEM activesupport (>= 6.1) sprockets (>= 3.0.0) stringio (3.1.5) + terser (1.2.5) + execjs (>= 0.3.0, < 3) thor (1.3.2) tilt (2.5.0) timeout (0.4.3) @@ -462,8 +464,6 @@ GEM bigdecimal (~> 3.1) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - uglifier (4.2.1) - execjs (>= 0.3.0, < 3) unicode-display_width (3.1.4) unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (4.0.4) @@ -534,7 +534,7 @@ DEPENDENCIES sidekiq-cron (~> 1.12.0) simple_form (~> 5.0.2) simplecov (~> 0.22) - uglifier (~> 4.2.0) + terser (~> 1.2) web-console (~> 4.2) BUNDLED WITH diff --git a/config/environments/production.rb b/config/environments/production.rb index 886d42e8..6bca2198 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,7 +1,7 @@ require "active_support/core_ext/integer/time" # Uglifier is only used on the precompile phase, so we can require it conditionally -require "uglifier" if ENV["SECRET_KEY_BASE"] == "dummy" +require "terser" if ENV["ASSETS_PRECOMPILE"] == "true" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -28,8 +28,8 @@ config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? # Compress CSS & JS using preprocessors only on the precompile phase - if ENV["SECRET_KEY_BASE"] == "dummy" - config.assets.js_compressor = Uglifier.new(harmony: true) + if ENV["ASSETS_PRECOMPILE"] == "true" + config.assets.js_compressor = Terser.new config.assets.css_compressor = :sass end