join_layers.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:rules_docker 作者: bazelbuild 项目源码 文件源码
def __init__(self, config_file, diffid_to_blobsum,
               blobsum_to_unzipped, blobsum_to_zipped, blobsum_to_legacy):
    self._config = config_file
    self._blobsum_to_unzipped = blobsum_to_unzipped
    self._blobsum_to_zipped = blobsum_to_zipped
    self._blobsum_to_legacy = blobsum_to_legacy
    config = json.loads(self._config)
    content = self.config_file().encode('utf-8')
    self._manifest = json.dumps({
        'schemaVersion': 2,
        'mediaType': docker_http.MANIFEST_SCHEMA2_MIME,
        'config': {
            'mediaType': docker_http.CONFIG_JSON_MIME,
            'size': len(content),
            'digest': 'sha256:' + hashlib.sha256(content).hexdigest()
        },
        'layers': [
            {
                'mediaType': docker_http.LAYER_MIME,
                'size': self.blob_size(diffid_to_blobsum[diff_id]),
                'digest': diffid_to_blobsum[diff_id]
            }
            for diff_id in config['rootfs']['diff_ids']
        ]
    }, sort_keys=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号