简体   繁体   中英

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. When a change is detected, a CodeBuild task is run to turn the repo into a Docker Image and pushes it to ECR. After that I run a CodeDeploy task to update the ECS cluster by running rake db:migrate and restarting the tasks.

All fine so far. But when I try to access my Rails app, I'm seeing the following error:

ActionView::Template::Error occurred while GET </> was processed by statics#home Exception The asset "application.css" is not present in the asset pipeline.

It seems that I need to run rake assets:precompile somewhere. I don't know how to make that work, should I:

  1. Define the precompilation in my Dockerfile?
  2. run the command in my CodeBuild script?
  3. Do something else?

Thanks in advance

在Dockerfile中 - RUN bundle exec rake assets:precompile

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM