Ruby on rails 6: who compile webpacker assets for platform.sh procution environment?

Hello everyone.
I have developed my project with rails 6, and currently the deployment is blocked by webpacker.
I contacted the support, but we couldn’t find a way to compile and @Matthias recommended me the forum, but I googled again, still nothing.
Can you help me?
below .platform.app.yaml



# The name of this app. Must be unique within a project.
name: app

type: 'ruby:2.7'


mounts:
    log:
      source: local
      source_path: log
    tmp:
      source: local
      source_path: tmp


relationships:
    postgresdatabase: 'dbpostgres:postgresql'


# The size of the persistent disk of the application (in MB).
disk: 1024


hooks:
    build: |
      bundle install --without development test
      RAILS_ENV=production bundle exec rake assets:precompile
    deploy: |
      RAILS_ENV=production bundle exec rake db:migrate 

web:
  upstream: 
    socket_family: "unix"
  commands: 
    start: "unicorn -l $SOCKET -E production config.ru"
  locations: 
    '/': 
      root: "public"
      passthru: true
      expires: 1h
      allow: true


everything is fine until I add this line to compile the assets in build hook

hooks:
    build: |
      bundle install --without development test
      RAILS_ENV=production bundle exec rake assets:precompile #assets compile line
    deploy: |
      RAILS_ENV=production bundle exec rake db:migrate 

and when I don’t compile the assets, the deployment is a success, but I get this error message when I try to access the application
Capture d’écran de 2021-04-07 16-54-25

see the complet log message

 Found 1 new commit
 
 Building application 'app' (runtime type: ruby:2.7, tree: 2ef6505)
   Generating runtime configuration.
   
  
     ............
     Bundle complete! 30 Gemfile dependencies, 77 gems now installed.
     Gems in the groups development and test were not installed.
     Use `bundle info [gemname]` to see where a bundled gem is installed.
     Post-install message from bootstrap_form:
     Default form attribute role="form" will be dropped in 5.0.0
     W: Yarn executable was not detected in the system.
     W: Download Yarn at https://yarnpkg.com/en/docs/install
     W: rake aborted!
     W: Autoprefixer doesn’t support Node v6.17.1. Update it.
     W: /app/.global/gems/autoprefixer-rails-10.2.4.0/lib/autoprefixer-rails/processor.rb:139:in `runtime'
     W: /app/.global/gems/autoprefixer-rails-10.2.4.0/lib/autoprefixer-rails/processor.rb:35:in `process'
     W: /app/.global/gems/autoprefixer-rails-10.2.4.0/lib/autoprefixer-rails/sprockets.rb:22:in `run'
     W: /app/.global/gems/autoprefixer-rails-10.2.4.0/lib/autoprefixer-rails/sprockets.rb:16:in `call'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:84:in `call_processor'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `reverse_each'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `call_processors'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/loader.rb:182:in `load_from_unloaded'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/loader.rb:59:in `block in load'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/loader.rb:337:in `fetch_asset_from_dependency_cache'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/loader.rb:43:in `load'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/cached_environment.rb:44:in `load'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/bundle.rb:32:in `block in call'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/bundle.rb:31:in `call'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:84:in `call_processor'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `reverse_each'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `call_processors'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/loader.rb:182:in `load_from_unloaded'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/loader.rb:59:in `block in load'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/loader.rb:337:in `fetch_asset_from_dependency_cache'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/loader.rb:43:in `load'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/cached_environment.rb:44:in `load'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/base.rb:81:in `find_asset'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/base.rb:88:in `find_all_linked_assets'
     W: /app/.global/gems/sprockets-4.0.2/lib/sprockets/manifest.rb:125:in `block (2 levels) in find'
     W: /app/.global/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:24:in `block in execute'
     W: /app/.global/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:41:in `block in synchronize'
     W: /app/.global/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:41:in `synchronize'
     W: /app/.global/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:41:in `synchronize'
     W: /app/.global/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:19:in `execute'
     W: /app/.global/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/promise.rb:563:in `block in realize'
     W: /app/.global/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:363:in `run_task'
     W: /app/.global/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:352:in `block (3 levels) in create_worker'
     W: /app/.global/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:335:in `loop'
     W: /app/.global/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:335:in `block (2 levels) in create_worker'
     W: /app/.global/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `catch'
     W: /app/.global/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `block in create_worker'
     W: Tasks: TOP => assets:precompile
     W: (See full trace by running task with --trace)
   
   E: Error building project: Step failed with status code 1.
 
 E: Error: Unable to build application, aborting.
 

thank you for your time

Hello Kamate,

Looking at the log your project need a newer nodejs version, currently our Ruby image have an old v6 but we can update it on build with nvm.

I’ve worked on a template for rails 6 you can find more detail here https://github.com/platformsh/template-builder/pull/390/files#diff-29cabc275a976caf43e6979441c37638d6265ae765130a3e4d192e81ed41e1dbR56

Hope that will help you.

Cheers
Laurent