Skip to content

Environment based manifest.json with single asset:precompile command #1782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
akshay-soni opened this issue Oct 29, 2018 · 2 comments
Closed

Comments

@akshay-soni
Copy link

I am trying to build environment neutral Docker image, so that same image can be used across staging and production without performing two asset:precompile (takes a lot of time to build an image).

Is there a way to create two manifest.json files? (each points to asset_host based on environment)

My current hack -
I build a production docker image and create another docker image from production as a base image for staging - with an extra bash command to replace asset_host in manifest.json with staging CDN.

Problem with this approach is - two docker images for one application, which is not a right way in terms of CI/CD pipelines.

@marcohamersma
Copy link

Hey, this might be related to #1845.

From what I could gather. Previous versions of Webpacker used to generate manifest.json files with relative asset paths, and the Rails app themselves would use config.action_controller.asset_host to construct the full URL to the assets referenced. (In that case your single docker image could be loaded with different environment variables and link to different CDNs). The asset paths are now hardcoded on compile time, which prevents this. Maybe this issue affects you as well?

@jakeNiemiec
Copy link
Member

The way webpacker handles this has changed since 2018.

Marco/Akshay, if the asset URLs still cause problems, feel free to re-open with updated information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants