I am using an asset host (AWS Cloudfront) for my Rails application:
# config/environments/production.rb
config.asset_host = "xxxxxxxxxxx.cloudfront.net"
During my deployment on my CI service I precompile assets:
bundle exec rake assets:precompile
And then push those generated assets to the S3 bucket that serves as the origin of the Cloudfront distribution.
Note: I don't include the precompiled assets in my final docker image that is eventually deployed.
Now when I start the server and try to access it - I receive the error:
application.css is not present in the asset pipeline
I know that there are multiple questions on Stackoverflow with this specific error message. But I tried everything e.g. like setting config.assets.compile = true/false but the only thing that made it work was including the precompiled assets in the build (final docker image).
So now I am asking myself: Do I have to always include the assets locally although I am using an asset host?!