Rails Shakapacker webpack builds produces different runtime-hash.js files on different environments

42 Views Asked by At

I'm building the rails assets using bundle exec rails assets:precompile in two environments, 1 - in docker, and 2 - in gitlab ci. The goal here is to serve the static assets out through cloudfront/s3 and have the rails application run in docker with asset_host = cloudfront url

The problem I'm seeing though is that when I build the assets in docker, I get files with one name, and when I build them in gitlab CI - the files are named differently. For example:

  • docker build: /packs/js/runtime-7449b50611b76cc223c5.js
  • gitlab ci: runtime-d70c98332a97744a01d1.js

So this causes issues because the rails app generates URLS for the docker build file, and the files don't exist in s3. I'm building both asset sets on the same git branch, same code base in docker vs CI.

Are there any ways to ensure these files match up between the environments?

0

There are 0 best solutions below