コード例 #1
0
 def put(self):
     user = self.get_argument('user', 'contoso')
     name = self.get_argument('name', '')
     if not name:
         return
     
     image = {'user': user, 'name': name}
     mongo_helper.save_my_images(image)
コード例 #2
0
def start_build(context):
    path = context["path"]
    url = context["url"]
    repo = context["repo"]
    user = context["user"]
    tag = context["tag"]
    str_tag = ".".join(str(tag))

    cmd = (
        "mkdir "
        + path
        + " && "
        + "cd "
        + path
        + " && "
        + "git clone "
        + url
        + " && "
        + "cd "
        + repo
        + " && "
        + "sudo docker build -t vophoto-test.chinacloudapp.cn:5000/"
        + user
        + "/"
        + repo
        + ":"
        + str_tag
        + " ."
        + " && "
        + "sudo docker push vophoto-test.chinacloudapp.cn:5000/"
        + user
        + "/"
        + repo
        + ":"
        + str_tag
        + " && "
        + "sudo rm -fr "
        + path
    )

    utils.run_command(config.config["config_server"], cmd)
    #     utils.run_command(config.config['config_server'], 'cd ' + path + " && " + 'git clone ' + url)
    #     utils.run_command(config.config['config_server'], 'cd ' + path + "/" + repo + " && " \
    #                       + 'sudo docker build -t vophoto-test.chinacloudapp.cn:5000/' + user + "/" + repo + ":" + str_tag + " .")
    #     utils.run_command(config.config['config_server'], 'sudo docker push vophoto-test.chinacloudapp.cn:5000/' + user + "/" + repo + ":" + str_tag)
    #     utils.run_command(config.config['config_server'], 'sudo rm -fr ' + path)

    image = {"user": user, "name": repo, "version": tag}
    mongo_helper.save_my_images(image)