Add configurable asset caching for Docker on Windows environments

This commit is contained in:
Andreas Nedbal 2020-04-25 13:02:20 +02:00
parent 2dbc6eff01
commit 1aec0f95a4
2 changed files with 12 additions and 2 deletions

View File

@ -1,5 +1,13 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
Rails.application.config.assets.configure do |env|
env.cache = Sprockets::Cache::FileStore.new(
ENV.fetch("SPROCKETS_CACHE", "#{env.root}/tmp/cache/assets"),
Rails.application.config.assets.cache_limit,
env.logger
)
end
# Version of your assets, change this if you want to expire all your assets. # Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0' Rails.application.config.assets.version = '1.0'
@ -9,4 +17,4 @@ Rails.application.config.assets.version = '1.0'
# Precompile additional assets. # Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
Rails.application.config.assets.precompile += %w( moderation.js ) Rails.application.config.assets.precompile += %w( moderation.js )
Rails.application.config.assets.precompile += %w( i18n.js ) Rails.application.config.assets.precompile += %w( i18n.js )

View File

@ -10,9 +10,11 @@ services:
links: links:
- postgres - postgres
- redis - redis
environment:
- SPROCKETS_CACHE=/cache
volumes: volumes:
- ./:/app - ./:/app
- cache:/app/tmp/cache - cache:/cache
ports: ports:
- 3000:3000 - 3000:3000