DEV Community

Discussion on: Deploy Rails static assets to CloudFront CDN - during Docker build time

Collapse
tlatsas profile image
Tasos Latsas

Thank you Robert for the great article! I am using a very similar setup and approach for the webpack(er) generated assets.

I wrote a gem called webpacker_uploader which parses the contents of the generated manifest.json file and then uploads all the file's entries to S3 using the aws-sdk-s3 gem.

By using this gem as an abstraction we can get away with storing credentials in .aws/credentials. We just call WebpackerUploader.upload!(provider) in a Rake task and we pass in the credentials through ENV variables from the CI. However, this approach will not work if you need to upload assets that are not present in the manifest file, as we rely on its contents.

Collapse
reiz profile image
Robert Reiz Author

Hey Tasos! Thanks for the note to webpacker_uploader. That looks interesting!