简体   繁体   English

RAILS_ENV,NODE_ENV独立的Docker映像

[英]RAILS_ENV, NODE_ENV independent Docker image

I've got an image with a Rails application that sets RAILS_ENV before installing gems, node packages, precompiling assets. 我有一个带有Rails应用程序的映像,该映像在安装gem,节点包,预编译资产之前设置了RAILS_ENV

I'm not sure, but I can imagine that assets:precompile would behave differently depending on the environment (minifying assets or not). 我不确定,但是我可以想象到, assets:precompile行为将取决于环境(是否缩小资产)而有所不同。

Can you imagine having to put anything environment specific into Dockerfile ? 您能想象必须在Dockerfile放入任何特定于环境的Dockerfile吗? Should I avoid that? 我应该避免这种情况吗? I don't like the idea of having to have environment specific images. 我不喜欢必须具有特定于环境的图像的想法。

You need to specify RAILS_ENV at least for precompiling assets. 您至少需要为预编译资产指定RAILS_ENV Specifically for this command, not for the whole image. 专门用于此命令,而不是整个图像。 Or else assets would build with non-production settings, would have different fingerprints, not those expected by your target environment. 否则资产将使用非生产设置进行构建,具有不同的指纹,而不是目标环境所期望的指纹。

So, with regard to assets managed by sprockets , you're fine as long as your environments' sprockets settings match those of production environment. 因此,对于由sprockets管理的资产,只要您环境的sprockets设置与生产环境的设置相匹配,就可以了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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