给定以下结构;
├── api/ - A PHP application, to have its own repository
├── docker/ - Docker configuration for shared containers (MySQL, Nginx)
├── docker-compose.yml - Defines all of the services
└── web-client/ - A standalone Angular application, to have its own repository目前,整个应用程序都位于一个存储库中,但我希望将其拆分为不同的存储库。发展还没有开始,所以保持任何历史都没有问题。
首先,是在根级docker-compose文件中定义所有服务是最好的方法,还是api和web-client应该与自己的docker-compose更加隔离,从而完全分开管理?如果分开,是否还有一个"depends_on“另一个?
其次,管理存储库的最佳方法是什么?根级代码(docker-compose.yml和docker/)应该存在于一个存储库中,但这也取决于其他两个存储库的存在,可能是子存储库。我研究了这方面的git子模块,但是似乎父存储库必须绑定到子程序中的特定提交,这可能会使处理多个并行特性变得困难吗?
发布于 2018-04-19 11:48:18
我的建议如下:
├── api/
|___ .git
|___ Dockerfile
|___ ... api src ...
├── docker/ - Docker configuration for shared containers (MySQL, Nginx)
├── docker-compose.yml - Defines all of the services
└── web-client/
|______ .git
|______ Dockerfile
|______ ... web-client src ...每个应用程序都应该封装自己的源代码和Dockerfile,它们都生活在同一个git中。
然后,docker-compose.yml文件将使用它们,如下所示:
(...)
services:
api:
build: ./api/
(...)
web-client:
build: ./web-client/这就是我通常看到的路。
如果您想无论如何使用多个docker-组合文件,您可能需要查看以下内容:https://docs.docker.com/compose/extends/
https://stackoverflow.com/questions/49918636
复制相似问题