This commit is contained in:
NewName
2024-11-08 22:18:41 +08:00
parent 10980f9485
commit aef5a7c203
8 changed files with 277 additions and 0 deletions

24
Caddyfile Normal file
View File

@@ -0,0 +1,24 @@
{$DOMAIN} {
root * /srv
file_server
}
dockerhub.{$DOMAIN} {
reverse_proxy * dockerhub:5000
}
ghcr.{$DOMAIN} {
reverse_proxy * ghcr:5000
}
gcr.{$DOMAIN} {
reverse_proxy * gcr:5000
}
k8sgcr.{$DOMAIN} {
reverse_proxy * k8sgcr:5000
}
registryk8s.{$DOMAIN} {
reverse_proxy * registryk8s:5000
}

48
docker-compose.yml Normal file
View File

@@ -0,0 +1,48 @@
services:
k8sgcr:
image: "registry:2.8.3"
container_name: "k8sgcr"
restart: "always"
volumes:
- "./k8sgcr/config.yml:/etc/docker/registry/config.yml"
ghcr:
image: "registry:2.8.3"
container_name: "ghcr"
restart: "always"
volumes:
- "./ghcr/config.yml:/etc/docker/registry/config.yml"
gcr:
image: "registry:2.8.3"
container_name: "gcr"
restart: "always"
volumes:
- "./gcr/config.yml:/etc/docker/registry/config.yml"
dockerhub:
image: "registry:2.8.3"
container_name: "dockerhub"
restart: "always"
volumes:
- "./dockerhub/config.yml:/etc/docker/registry/config.yml"
registryk8s:
image: "registry:2.8.3"
container_name: "registryk8s"
restart: "always"
volumes:
- "./registryk8s/config.yml:/etc/docker/registry/config.yml"
caddy:
image: caddy:alpine
container_name: caddy
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- ./index.html:/srv/index.html
environment:
- DOMAIN=example.com # 修改为你的域名
restart: always

16
dockerhub/config.yml Normal file
View File

@@ -0,0 +1,16 @@
version: 0.1
storage:
filesystem:
rootdirectory: /var/lib/registry
delete:
enabled: true
maintenance:
uploadpurging:
enabled: true
age: 72h
dryrun: false
interval: 1m
http:
addr: 0.0.0.0:5000
proxy:
remoteurl: https://registry-1.docker.io

16
gcr/config.yml Normal file
View File

@@ -0,0 +1,16 @@
version: 0.1
storage:
filesystem:
rootdirectory: /var/lib/registry
delete:
enabled: true
maintenance:
uploadpurging:
enabled: true
age: 72h
dryrun: false
interval: 1m
http:
addr: 0.0.0.0:5000
proxy:
remoteurl: https://gcr.io

16
ghcr/config.yml Normal file
View File

@@ -0,0 +1,16 @@
version: 0.1
storage:
filesystem:
rootdirectory: /var/lib/registry
delete:
enabled: true
maintenance:
uploadpurging:
enabled: true
age: 72h
dryrun: false
interval: 1m
http:
addr: 0.0.0.0:5000
proxy:
remoteurl: https://ghcr.io

125
index.html Normal file
View File

@@ -0,0 +1,125 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Docker Hub 域名展示</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.0.0/dist/themes/light.css" />
<script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.0.0/dist/shoelace.js"></script>
<style>
body {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
font-family: Arial, sans-serif;
background-color: #f4f4f4;
}
.domain-container {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 2rem;
}
.domain-item {
display: flex;
align-items: center;
justify-content: center;
background-color: white;
border-radius: 8px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
padding: 1rem 2rem;
margin-bottom: 1rem;
width: 300px;
}
.domain-text {
flex-grow: 1;
font-size: 1.2rem;
font-weight: bold;
}
.copy-button {
margin-left: 1rem;
}
.footer {
display: flex;
align-items: center;
justify-content: center;
margin-top: 2rem;
}
.footer a {
color: #333;
text-decoration: none;
margin-left: 0.5rem;
}
.footer a:hover {
color: #555;
}
</style>
</head>
<body>
<div class="domain-container">
<div class="domain-item">
<div class="domain-text">dockerhub.example.com</div>
<sl-button class="copy-button" variant="primary" @click="copyToClipboard('dockerhub.example.com')">复制</sl-button>
</div>
<div class="domain-item">
<div class="domain-text">ghcr.example.com</div>
<sl-button class="copy-button" variant="primary" @click="copyToClipboard('ghcr.example.com')">复制</sl-button>
</div>
<div class="domain-item">
<div class="domain-text">gcr.example.com</div>
<sl-button class="copy-button" variant="primary" @click="copyToClipboard('gcr.example.com')">复制</sl-button>
</div>
<div class="domain-item">
<div class="domain-text">k8sgcr.example.com</div>
<sl-button class="copy-button" variant="primary" @click="copyToClipboard('k8sgcr.example.com')">复制</sl-button>
</div>
<div class="domain-item">
<div class="domain-text">registryk8s.example.com</div>
<sl-button class="copy-button" variant="primary" @click="copyToClipboard('registryk8s.example.com')">复制</sl-button>
</div>
</div>
<div class="footer">
<span>注意: 所有域名使用 "example.com" 顶级域名。</span>
<a href="https://github.com/sky22333/Docker-Hub" target="_blank">
<sl-icon name="github" size="24"></sl-icon>
</a>
</div>
<script>
const domainText = document.querySelectorAll('.domain-text');
const copyButtons = document.querySelectorAll('.copy-button');
const domainBase = 'example.com';
domainText.forEach((text, index) => {
text.textContent = text.textContent.replace('example.com', domainBase);
});
copyButtons.forEach((button, index) => {
button.addEventListener('click', () => {
copyToClipboard(domainText[index].textContent);
});
});
function copyToClipboard(text) {
navigator.clipboard.writeText(text);
const toast = Object.assign(document.createElement('sl-toast'), {
duration: 2000,
label: '已复制到剪贴板',
});
document.body.appendChild(toast);
toast.show();
}
</script>
</body>
</html>

16
k8sgcr/config.yml Normal file
View File

@@ -0,0 +1,16 @@
version: 0.1
storage:
filesystem:
rootdirectory: /var/lib/registry
delete:
enabled: true
maintenance:
uploadpurging:
enabled: true
age: 72h
dryrun: false
interval: 1m
http:
addr: 0.0.0.0:5000
proxy:
remoteurl: https://k8s.gcr.io

16
registryk8s/config.yml Normal file
View File

@@ -0,0 +1,16 @@
version: 0.1
storage:
filesystem:
rootdirectory: /var/lib/registry
delete:
enabled: true
maintenance:
uploadpurging:
enabled: true
age: 72h
dryrun: false
interval: 1m
http:
addr: 0.0.0.0:5000
proxy:
remoteurl: https://registry.k8s.io