如何将存储库维护到单个存储库中

时间:2016-07-06 12:34:37

标签: git docker docker-compose microservices

我有一个每个微服务的存储库(' A',' B',..)。存储库的结构如下所示:

A
|-dockerfile
|-src
  |-Java
  |-Groovy

由于所有这些存储库都属于一个名为' WholeProject'的项目,我想维护一个存储库' WholeProject'看起来像:

WholeProject
|-docker-compose.yml
|-µS
  |-A
  |-B
  |-..

因此,我可以轻松维护一个docker-compose文件和一个包含有关我项目的所有重要信息的存储库。

这是个好主意吗?我该怎么做?

1 个答案:

答案 0 :(得分:1)

您可以考虑将git submodules与:

一起使用
 'use strict';

      //prepared stage object
      var preparedStage;

      //onload function will call first when controller invkoed
      function onLoad() {
        var width = window.innerWidth;
        var height = window.innerHeight;

        // first we need Konva core things: stage and layer
        preparedStage = new Konva.Stage({
          container: 'container',
          width: width,
          height: height
        });
      }

      //stage controller
      function StageController($scope) {
        //load function 
        onLoad();
        //get prepared stage object.
        var stage = preparedStage;
        //get layer object
        var layer = new Konva.Layer();
        //add laeyr onto the stage
        stage.add(layer);

        // then we are going to draw into special canvas element
        var canvas = document.createElement('canvas');
        canvas.width = 800;
        canvas.height = 400;
        // creted canvas we can add to layer as "Konva.Image" element
        var image = new Konva.Image({
          image: canvas,
          x: stage.width() / 4,
          y: stage.height() / 4,
          stroke: 'green',
          shadowBlur: 15
        });
        //add image onto the layer
        layer.add(image);
        //finally drew the stage.
        stage.draw();
      }
    //angular module 
      var app = angular.module('app', []),
          requires = [
            '$scope',
            StageController
          ];
      //controller with dependences array.
      app.controller('StageController', requires);

这样,你可以用:

克隆WholeProject
cd /path/to/WholeProject
git submodule -- /url/to/repo/A µS/A
git submodule -- /url/to/repo/B µS/B

您在最后记录的SHA1上获得git clone --recursive A