Rails 4.1.6 Asset pipeline does not load assets and javascript into production

I have a ruby ​​on the rails web server that I am trying to deploy in production. I'm having problems loading assets into production: .css, .js and images (it seems to work fine because of this.

Here is my production.rb

Rails.application.configure do

  # Code is not reloaded between requests.
  config.cache_classes = true

  # Eager load code on boot. This eager loads most of Rails and
  # your application in memory, allowing both threaded web servers
  # and those relying on copy on write to perform better.
  # Rake tasks automatically ignore this option for performance.
  config.eager_load = true

  # Full error reports are disabled and caching is turned on.
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  config.serve_static_files = true

  # Compress JavaScripts and CSS.
  config.assets.js_compressor = :uglifier

  # Do not fallback to assets pipeline if a precompiled asset is missed.
  config.assets.compile = false

  # Generate digests for assets URLs.
  config.assets.digest = true
end

Previously, I had a deployed version of the same server, and its tags looked like this: application.html.erb:

<head>
  <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  <%= csrf_meta_tags %>
</head>

in production (loaded css / js)

<link data-turbolinks-track="true" href="/assets/application-06ed3643d0bf74fdf192f533cc269506.css" media="all" rel="stylesheet" />
<script data-turbolinks-track="true" src="/assets/application-f134ff018deb0477bd5ad046d853559d.js"></script>

When my application is deployed now, it looks like this (without a fingerprint). Precompilation does not seem to work. There are no files in the public / assets, which is a problem. Currently my application manifest is as follows

<link data-turbolinks-track="true" href="/stylesheets/application.css" media="all" rel="stylesheet" />
<script data-turbolinks-track="true" src="/javascripts/application.js"></script>

, - . css js . -: . ?

, :

config.assets.compile = true


Rails.application.config.assets.precompile << /(^[^_\/]|\/[^_])[^\/]*$/

, , . , . !

. , application.js /assets/javascripts, application.css.scss /assets/stylesheets - ,

+4
1

, . , , Dockerfile

RUN rake assets:precompile

, . !

0

Source: https://habr.com/ru/post/1656116/


All Articles