| 361 | self.add_line(f"COPY {source} {destination}") |
| 362 | |
| 363 | def write_text(self, text: str, destination: Union[str, PurePosixPath]) -> None: |
| 364 | if not self.context: |
| 365 | raise Exception("No context available") |
| 366 | |
| 367 | if not isinstance(destination, PurePosixPath): |
| 368 | destination = PurePosixPath(destination) |
| 369 | |
| 370 | source_hash = hashlib.sha256(text.encode()).hexdigest() |
| 371 | (self.context / f".{source_hash}").write_text(text) |
| 372 | self.add_line(f"COPY .{source_hash} {destination}") |
| 373 | |
| 374 | def build( |
| 375 | self, pull: bool = False, stream_progress_to: Optional[TextIO] = None |