优化配置
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
---
|
||||
|
||||
1:根域名解析到你的服务器,将`k8sgcr`,`ghcr`,`gcr`,`docker`,`registryk8s`这个几个配置解析为你的二级域名。
|
||||
1:域名解析:将`hub`,`quay`,`ghcr`,`gcr`,`docker`,`registryk8s`这个几个解析为你的二级域名。
|
||||
|
||||
> 直接泛解析更方便
|
||||
|
||||
@@ -19,10 +19,10 @@ git clone https://github.com/sky22333/docker-proxy.git
|
||||
```
|
||||
|
||||
|
||||
3:其他无需修改,只需修改`docker-compose.yml`配置里的域名环境变量,修改为你的主域名
|
||||
3:其他无需修改,只需修改`docker-compose.yml`配置里的域名环境变量,修改为你的根域名
|
||||
然后启动即可。
|
||||
```
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
4:部署完成后访问域名查看
|
||||
4:部署完成后访问`hub.example.com`查看前端
|
||||
|
||||
@@ -12,12 +12,12 @@ services:
|
||||
- DOMAIN=example.com # 修改为你的域名
|
||||
restart: always
|
||||
|
||||
k8sgcr:
|
||||
quay:
|
||||
image: "registry:2.8.3"
|
||||
container_name: "k8sgcr"
|
||||
container_name: "quay"
|
||||
restart: "always"
|
||||
volumes:
|
||||
- "./k8sgcr/config.yml:/etc/docker/registry/config.yml"
|
||||
- "./quay/config.yml:/etc/docker/registry/config.yml"
|
||||
|
||||
ghcr:
|
||||
image: "registry:2.8.3"
|
||||
|
||||
@@ -13,4 +13,4 @@ storage:
|
||||
http:
|
||||
addr: 0.0.0.0:5000
|
||||
proxy:
|
||||
remoteurl: https://k8s.gcr.io
|
||||
remoteurl: https://quay.io
|
||||
@@ -1,4 +1,4 @@
|
||||
{$DOMAIN} {
|
||||
hub.{$DOMAIN} {
|
||||
root * /srv
|
||||
file_server
|
||||
}
|
||||
@@ -15,8 +15,8 @@ gcr.{$DOMAIN} {
|
||||
reverse_proxy * gcr:5000
|
||||
}
|
||||
|
||||
k8sgcr.{$DOMAIN} {
|
||||
reverse_proxy * k8sgcr:5000
|
||||
quay.{$DOMAIN} {
|
||||
reverse_proxy * quay:5000
|
||||
}
|
||||
|
||||
registryk8s.{$DOMAIN} {
|
||||
|
||||
@@ -91,23 +91,23 @@
|
||||
|
||||
<div class="domain-container">
|
||||
<div class="domain-item">
|
||||
<div class="domain-text">docker.<span id="domain-base"></span></div>
|
||||
<div class="domain-text">docker.<span id="domain-docker"></span></div>
|
||||
<button class="copy-button">复制</button>
|
||||
</div>
|
||||
<div class="domain-item">
|
||||
<div class="domain-text">ghcr.<span id="domain-base"></span></div>
|
||||
<div class="domain-text">ghcr.<span id="domain-ghcr"></span></div>
|
||||
<button class="copy-button">复制</button>
|
||||
</div>
|
||||
<div class="domain-item">
|
||||
<div class="domain-text">gcr.<span id="domain-base"></span></div>
|
||||
<div class="domain-text">gcr.<span id="domain-gcr"></span></div>
|
||||
<button class="copy-button">复制</button>
|
||||
</div>
|
||||
<div class="domain-item">
|
||||
<div class="domain-text">k8sgcr.<span id="domain-base"></span></div>
|
||||
<div class="domain-text">quay.<span id="domain-quay"></span></div>
|
||||
<button class="copy-button">复制</button>
|
||||
</div>
|
||||
<div class="domain-item">
|
||||
<div class="domain-text">registryk8s.<span id="domain-base"></span></div>
|
||||
<div class="domain-text">registryk8s.<span id="domain-registryk8s"></span></div>
|
||||
<button class="copy-button">复制</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -127,11 +127,17 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const domainBase = new URL(window.location.href).hostname.replace(/^www\./, '');
|
||||
document.querySelectorAll('#domain-base').forEach(el => {
|
||||
el.textContent = domainBase;
|
||||
});
|
||||
// 从 Docker 环境变量获取根域名
|
||||
const rootDomain = process.env.DOMAIN || 'example.com';
|
||||
|
||||
// 动态设置每个仓库的根域名部分
|
||||
document.getElementById('domain-docker').textContent = rootDomain;
|
||||
document.getElementById('domain-ghcr').textContent = rootDomain;
|
||||
document.getElementById('domain-gcr').textContent = rootDomain;
|
||||
document.getElementById('domain-quay').textContent = rootDomain;
|
||||
document.getElementById('domain-registryk8s').textContent = rootDomain;
|
||||
|
||||
// 复制按钮功能
|
||||
document.querySelectorAll('.copy-button').forEach(button => {
|
||||
button.addEventListener('click', async () => {
|
||||
const domainText = button.previousElementSibling.textContent;
|
||||
|
||||
Reference in New Issue
Block a user