简体   繁体   English

如何在ECS Fargate环境中运行Rails应用程序之前预编译资产?

[英]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: 我不知道如何做这项工作,我应该:

  1. Define the precompilation in my Dockerfile? 在我的Dockerfile中定义预编译?
  2. run the command in my CodeBuild script? 在我的CodeBuild脚本中运行该命令?
  3. Do something else? 做点别的吗?

Thanks in advance 提前致谢

在Dockerfile中 - RUN bundle exec rake assets:precompile

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 资源如何在开发环境中预编译在ruby on rails上? - How assets precompile in development environment on ruby on rails? 如何在开发环境中预编译 rails 中的资产? - How do I precompile assets in rails in development environment? 无法运行rake资产:在rails中预编译 - can't running rake assets:precompile in rails 这个难题的缺失部分:如何在AWS ECS Fargate环境中运行Rails C. - The missing piece of the puzzle: how to run Rails C on an AWS ECS Fargate environment 使用Capistrano进行Rails应用部署杀死资产预编译 - Rails app deployment with capistrano Killing assets precompile Rails - 我可以运行rake资产:在生产服务器上预编译,而生产应用程序仍在运行吗? - Rails - Can I run rake assets:precompile on production server, while the production app is still running? Rails 4 + Capistrano 2:如果资产没有改变,如何不预编译资产? - Rails 4 + Capistrano 2: How to not precompile assets if they're not changed? 如何知道资产:在Rails上完成预编译? - How to know assets:precompile done on Rails? 如何使“资产:预编译”不加载数据库? (导轨) - How to make “assets:precompile” NOT load the database? (Rails) rake assets:precompile 启动环境 3 次是否正常? (轨道 3.2.3) - is it normal for rake assets:precompile to launch the environment 3 times? (rails 3.2.3)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM