Sync the description to Docker Hub if the image is publishable and a README.md file exists.
(self)
| 922 | self.depends_on.append(match.group(1).decode()) |
| 923 | |
| 924 | def sync_description(self) -> None: |
| 925 | """Sync the description to Docker Hub if the image is publishable |
| 926 | and a README.md file exists.""" |
| 927 | |
| 928 | if not self.publish: |
| 929 | ui.say(f"{self.name} is not publishable") |
| 930 | return |
| 931 | |
| 932 | readme_path = self.path / "README.md" |
| 933 | has_readme = readme_path.exists() |
| 934 | if not has_readme: |
| 935 | ui.say(f"{self.name} has no README.md or description") |
| 936 | return |
| 937 | |
| 938 | docker_config = os.getenv("DOCKER_CONFIG") |
| 939 | spawn.runv( |
| 940 | [ |
| 941 | "docker", |
| 942 | "pushrm", |
| 943 | f"--file={readme_path}", |
| 944 | *([f"--config={docker_config}/config.json"] if docker_config else []), |
| 945 | *([f"--short={self.description}"] if self.description else []), |
| 946 | self.docker_name(), |
| 947 | ] |
| 948 | ) |
| 949 | |
| 950 | def docker_name(self, tag: str | None = None) -> str: |
| 951 | """Return the name of the image on Docker Hub at the given tag.""" |
no test coverage detected