Skip to content

Commit

Permalink
add iterative image building
Browse files Browse the repository at this point in the history
  • Loading branch information
AmozPay authored and AmozPay committed Oct 13, 2022
1 parent 262d11b commit 20b6265
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/aleph_client/docker/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,23 @@ def recursive_compute_chain_id(index: int) -> str:
chain_ids.append(chain_id)
return chain_id



# TODO: test this iterative version
iterative_chain_ids = []
def iterative_compute_chain_id(index: int) -> str:
diff_id = self.diff_ids[0]
iterative_chain_ids.append(diff_id)
i = 1
while i < index:
chain_id = "sha256:" + sha256(
iterative_chain_ids[i - 1].encode()
+ " ".encode()
+ self.diff_ids[i].encode()
).hexdigest()
iterative_chain_ids.append(chain_id)
return

recursive_compute_chain_id(len(self.layers_ids) - 1)

return chain_ids

0 comments on commit 20b6265

Please sign in to comment.