In my local machine when I do:
RAILS_ENV=production bundle exec rake assets:precompile
RAILS_ENV=production bundle exec puma -e production
Everything works fine. However I have the exact same app in a docker container for production that runs with nginx. I can see the application.css & application.js files in the assets folder with the chrome dev tools and they're not empty. But I have a page with no css/js, it should have something to do with nginx but I'm really confused.
/var/etc/nginx/nginx.conf:
user app sudo;
http{
upstream app {
server unix:/home/app/puma.sock fail_timeout=0;
}
server {
listen 80 default;
root /home/app/app/public;
try_files $uri/index.html $uri @app;
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app;
}
}
}
events {worker_connections 1024;}
config/environments/production.rb:
Rails.application.configure do
...
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.serve_static_files = true
config.assets.js_compressor = :uglifier
config.assets.compile = false
config.assets.digest = true
...
end
Please do not hesitate to suggest anything. :)
update: I've just realised that I have these 2 errors in my console:
new:11 Resource interpreted as Stylesheet but transferred with MIME type text/plain: "http://localhost/assets/application-5574b338d88d13681ef38b9b0800bc47.css".
new:12 Resource interpreted as Script but transferred with MIME type text/plain: "http://localhost/assets/application-ea59e17aff7f15a316e3e03d49f3daf4.js".