哪些设置可以在不重新构建容器的情况下进行配置?

你好

有一个关于将相同的 Discourse 镜像部署到多个环境(如预发布、测试版、生产环境等)的问题。

我希望在 CI/CD 流水线中只构建一次 Discourse 镜像,将其推送到仓库,然后在所有环境中运行完全相同的 Discourse 镜像。我希望环境之间的差异(如主机名等)通过环境变量或容器外部的配置文件来表示。根据我对 Discourse 的使用经验,目前并不完全清楚哪些设置是固化在镜像中的,哪些可以通过修改 YAML 文件(无需重新构建)安全地进行配置。

请问是否有某个地方列出了可以在每个环境中安全配置而无需重新构建容器的变量?

Welcome, @russellwstanley. There has been lots of discussion of people who want to be able to have a docker_compose file that solves all their problems, but it’s not quite that simple. There has been much discussion about this (that I can’t find in 30 seconds).

To see what settings you can pass to the container you can look at discourse/config/discourse.config.sample at main · discourse/discourse · GitHub and discourse/config/site_settings.yml at main · discourse/discourse · GitHub to see what can be configured with environment variables.

But some things need to be done with things like

rake db:migrate
rake assets:precompile

so even if you get an image that has all the right stuff, it’s not quite as simple as just cranking it up.

Thanks so much for your quick reply @pfaffman. I’ll take a look at those settings and see if I can make something work.