79 lines
3.9 KiB
Python
79 lines
3.9 KiB
Python
import os
|
|
|
|
tags = [
|
|
"Home-ubuntu-latest:docker://diskststion.jiang1446.i234.me/gitea/runner-images:ubuntu-latest",
|
|
"Home-ubuntu-22.04:docker://diskststion.jiang1446.i234.me/gitea/runner-images:ubuntu-22.04",
|
|
"Home-ubuntu-20.04:docker://diskststion.jiang1446.i234.me/gitea/runner-images:ubuntu-20.04",
|
|
"Home-ubuntu24.04:docker://diskststion.jiang1446.i234.me/library/ubuntu:24.04",
|
|
"Home-ubuntu22.04:docker://diskststion.jiang1446.i234.me/library/ubuntu:22.04",
|
|
"Home-ubuntu20.04:docker://diskststion.jiang1446.i234.me/library/ubuntu:20.04",
|
|
"Home-ubuntu18.04:docker://diskststion.jiang1446.i234.me/library/ubuntu:18.04",
|
|
"Home-ubuntu16.04:docker://diskststion.jiang1446.i234.me/library/ubuntu:16.04",
|
|
"Home-ubuntu14.04:docker://diskststion.jiang1446.i234.me/library/ubuntu:14.04",
|
|
"Home-centos7:docker://diskststion.jiang1446.i234.me/library/centos:centos7",
|
|
"Home-centos8:docker://diskststion.jiang1446.i234.me/library/centos:centos8",
|
|
"Home-kali:docker://diskststion.jiang1446.i234.me/kalilinux/kali-rolling:latest",
|
|
"Home-debian11:docker://diskststion.jiang1446.i234.me/library/debian:11",
|
|
"Home-debian12:docker://diskststion.jiang1446.i234.me/library/debian:12",
|
|
"Home-fedora39:docker://diskststion.jiang1446.i234.me/library/fedora:39",
|
|
"Home-fedora40:docker://diskststion.jiang1446.i234.me/library/fedora:40",
|
|
"Home-fedora41:docker://diskststion.jiang1446.i234.me/library/fedora:41",
|
|
"Home-fedora42:docker://diskststion.jiang1446.i234.me/library/fedora:42",
|
|
"Home-archlinux:docker://diskststion.jiang1446.i234.me/library/archlinux:latest",
|
|
"Home-opensuse:docker://diskststion.jiang1446.i234.me/library/opensuse:latest"
|
|
]
|
|
|
|
platform = [
|
|
"amd64",
|
|
"arm64",
|
|
"arm",
|
|
"ppc64le",
|
|
"riscv64",
|
|
"s390x"
|
|
]
|
|
|
|
uuid = ""
|
|
def getimg(sh):
|
|
global uuid
|
|
run = 1
|
|
while run == 1:
|
|
os.system(sh + " 2>logs.log")
|
|
rad = os.popen("cat logs.log").read()
|
|
if rad == "":
|
|
uuid = ""
|
|
while True:
|
|
# rad = os.popen(sh + " 2>logs.log").read()
|
|
# erad = os.popen("cat logs.log").read()
|
|
# if erad == "":
|
|
sh = "docker images | grep " + sh.split(" ")[-1].split(":")[0] + " | grep " + sh.split(" ")[-1].split(":")[1] + " | awk '{print $3}'"
|
|
uuid = os.popen(sh).read().split("\n")[0]
|
|
# uuid = rad.split("sha256:")[1].split("\n")[0][-12:]
|
|
print("UUID: " + uuid)
|
|
return True
|
|
elif rad[:len("no matching manifest for")] == "no matching manifest for":
|
|
print(rad)
|
|
return False
|
|
else:
|
|
print(rad)
|
|
for i in tags:
|
|
print("")
|
|
print(i)
|
|
link = i.split("diskststion.jiang1446.i234.me")
|
|
cmd_link = "docker manifest create --insecure docker.jiang1446.i234.me" + link[1] + " "
|
|
platforms = ""
|
|
platform_uuid = {}
|
|
for x in platform:
|
|
os.system("docker rmi dockerproxy.net" + link[1] + " ")
|
|
print("docker pull --platform linux/" + x + " dockerproxy.net" + link[1])
|
|
if getimg("docker pull --platform linux/" + x + " dockerproxy.net" + link[1]):
|
|
os.system("docker tag dockerproxy.net" + link[1] + " docker.jiang1446.i234.me" + link[1].split(":")[0] + ":" + uuid + " ")
|
|
cmd_link += "docker.jiang1446.i234.me" + link[1].split(":")[0] + ":" + uuid + " "
|
|
os.system("docker push docker.jiang1446.i234.me" + link[1].split(":")[0] + ":" + uuid + " ")
|
|
platforms += x + "\t"
|
|
os.system("docker rmi dockerproxy.net" + link[1] + " ")
|
|
platform_uuid[x] = uuid
|
|
os.system(cmd_link)
|
|
for x in platforms.split("\t"):
|
|
if x != "":
|
|
os.system("docker manifest annotate docker.jiang1446.i234.me" + link[1] + " docker.jiang1446.i234.me" + link[1].split(":")[0] + ":" + platform_uuid[x] + " --os linux --arch " + x + "")
|
|
os.system("docker manifest push docker.jiang1446.i234.me" + link[1]) |