[英]How to precompile assets before running a Rails App on a ECS Fargate environment?
I have a CodePipeline set-up that tracks updates to a private GIT repo. 我有一个CodePipeline设置,可以跟踪私有GIT仓库的更新。 When a change is detected, a CodeBuild task is run to turn the repo into a Docker Image and pushes it to ECR.
检测到更改时,将运行CodeBuild任务以将repo转换为Docker Image并将其推送到ECR。 After that I run a CodeDeploy task to update the ECS cluster by running
rake db:migrate
and restarting the tasks. 之后,我运行CodeDeploy任务,通过运行
rake db:migrate
并重新启动任务来更新ECS集群。
All fine so far. 到目前为止都很好。 But when I try to access my Rails app, I'm seeing the following error:
但是当我尝试访问我的Rails应用程序时,我看到以下错误:
ActionView::Template::Error
occurred while GET </>
was processed by statics#home
Exception The asset "application.css" is not present in the asset pipeline. ActionView::Template::Error
在 statics#home
处理 GET </>
时 发生 ActionView::Template::Error
异常资产管道中不存在资产“application.css”。
It seems that I need to run rake assets:precompile
somewhere. 看来我需要运行
rake assets:precompile
某处rake assets:precompile
。 I don't know how to make that work, should I: 我不知道如何做这项工作,我应该:
Thanks in advance 提前致谢
在Dockerfile中 - RUN bundle exec rake assets:precompile
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.