简体   繁体   English

docker-一个Dockerfile和docker-compose.yml上的多个项目

[英]docker - multiple projects on one Dockerfile and docker-compose.yml

I'm starting with Docker and in my opinion is great! 我从Docker开始,我认为这很棒! Now I'm looking solution for this organization: 现在,我正在寻找该组织的解决方案:
Now I have this structure: 现在我有了这个结构:

Applications
| +--app1
| |  +--node_modules   
| |  +--package.json  
| |  +--...  
| +--app2  
| |  +--node_modules
| |  +--package.json  
| |  +--...  
| ....   
| docker-compose.app1.yml
| docker-compose.app2.yml
| ....
| Dockerfile  //my personalized image for all projects

But I want reach this: 但我想达到这一点:

Applications
| +--app1  
| |  +--node_modules //empty in host  
| |  +--package.json  
| |  +--docker-compose.app1.yml  //override compose
| |  +--...  
| +--app2  
| |  +--node_modules  //empty in host  
| |  +--package.json  
| |  +--...  
| ....  
| +--node_modules //global node_modules folder (linked to projects)  
| docker-compose.yml //principal compose  
| Dockerfile  //my personalized image for all projects

I thinking too about create one global "server" and link all projects on VHosts but how I'll get access to each of project? 我也考虑创建一个全局“服务器”并链接VHost上的所有项目,但是我将如何访问每个项目?

You are looking for docker-comopose extends. 您正在寻找docker-comopose扩展。 Thas permits you override previus configurations. Thas允许您覆盖先前的配置。

web: 
    extends: file: common-services.yml
    service: webapp

See full documentation in : https://docs.docker.com/compose/extends/#extending-services 请参阅以下文档中的完整文档: https : //docs.docker.com/compose/extends/#extending-services

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

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