Test webhook
This commit is contained in:
@@ -14,12 +14,8 @@ services:
|
||||
REGISTRY_STORAGE_DELETE_ENABLED: 'true'
|
||||
volumes:
|
||||
- /mnt/data/External/docker_registry/registry_data:/var/lib/registry
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:5000/v2/"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
networks:
|
||||
- docker-registry-network
|
||||
|
||||
# 2. Registry 管理界面 - Web UI,方便查看和管理存儲的映像
|
||||
registry-ui:
|
||||
@@ -30,21 +26,16 @@ services:
|
||||
- "5600:80"
|
||||
environment:
|
||||
REGISTRY_TITLE: "Docker Registry"
|
||||
REGISTRY_URL: "http://registry:5000"
|
||||
SINGLE_REGISTRY: 'true'
|
||||
REGISTRY_SECURED: 'false'
|
||||
REGISTRY_USERNAME: "admin"
|
||||
REGISTRY_PASSWORD: "change_me"
|
||||
DELETE_IMAGES: 'true'
|
||||
SHOW_CATALOG_NB_TAGS: 'true'
|
||||
NGINX_PROXY_PASS_URL: 'http://registry:5000'
|
||||
NGINX_RESOLVER: '127.0.0.11'
|
||||
networks:
|
||||
- docker-registry-network
|
||||
depends_on:
|
||||
registry:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:80/"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
- registry
|
||||
|
||||
# 3. Docker Hub 鏡像加速 - 緩存 Docker Hub 映像,加速拉取速度
|
||||
registry-mirror:
|
||||
@@ -59,12 +50,36 @@ services:
|
||||
REGISTRY_STORAGE_DELETE_ENABLED: 'true'
|
||||
volumes:
|
||||
- /mnt/data/External/docker_registry/mirror_data:/var/lib/registry
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:5000/v2/"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
networks:
|
||||
- docker-registry-network
|
||||
|
||||
# 3.5. 垃圾回收服務 - 定期清理未被引用的 blobs 和 manifests
|
||||
registry-gc:
|
||||
image: registry:2
|
||||
container_name: docker-registry-gc
|
||||
restart: always
|
||||
# 每天凌晨 2 點執行垃圾回收
|
||||
entrypoint: |
|
||||
sh -c 'while true; do
|
||||
echo "[$(date)] 執行垃圾回收..." >> /tmp/gc.log
|
||||
registry garbage-collect /etc/docker/registry/config.yml >> /tmp/gc.log 2>&1
|
||||
echo "[$(date)] 垃圾回收完成,等待 24 小時後再執行..." >> /tmp/gc.log
|
||||
sleep 86400
|
||||
done'
|
||||
volumes:
|
||||
# 掛載 Registry 存儲目錄(共享相同的數據)
|
||||
- /mnt/data/External/docker_registry/registry_data:/var/lib/registry:ro
|
||||
- registry_gc_logs:/tmp
|
||||
environment:
|
||||
# Registry 配置
|
||||
REGISTRY_HTTP_ADDR: 0.0.0.0:5000
|
||||
REGISTRY_STORAGE_DELETE_ENABLED: 'true'
|
||||
depends_on:
|
||||
- registry
|
||||
networks:
|
||||
- docker-registry-network
|
||||
# 注意:垃圾回收會掃描所有 blobs,在大型 Registry 上可能耗時較久
|
||||
# 如需精確控制執行時間,可改用 cron 容器或宿主定時任務
|
||||
|
||||
# 4. Docker 編譯伺服器 - Docker-in-Docker,隔離編譯環境
|
||||
build-server:
|
||||
@@ -93,38 +108,24 @@ services:
|
||||
image: drone/drone:latest
|
||||
container_name: drone-server
|
||||
restart: always
|
||||
ports:
|
||||
- "5400:80"
|
||||
environment:
|
||||
DRONE_SERVER_HOST: localhost:5400
|
||||
DRONE_SERVER_PROTO: http
|
||||
DRONE_SERVER_HOST: dronedocker.karylab.com
|
||||
DRONE_SERVER_PROTO: https
|
||||
DRONE_RPC_SECRET: ${DRONE_RANDOM_SECRET}
|
||||
# Git 平台配置(根據你使用的平台選擇)
|
||||
# GitHub 配置
|
||||
# DRONE_GITHUB_CLIENT_ID: "your-github-client-id"
|
||||
# DRONE_GITHUB_CLIENT_SECRET: "your-github-secret"
|
||||
# GitLab 配置
|
||||
# DRONE_GITLAB_SERVER: https://gitlab.example.com
|
||||
# DRONE_GITLAB_CLIENT_ID: "your-gitlab-client-id"
|
||||
# DRONE_GITLAB_CLIENT_SECRET: "your-gitlab-secret"
|
||||
# Gitea 配置
|
||||
# DRONE_GITEA_SERVER: http://gitea.example.com
|
||||
# DRONE_GITEA_CLIENT_ID: "your-gitea-client-id"
|
||||
# DRONE_GITEA_CLIENT_SECRET: "your-gitea-secret"
|
||||
# 初始管理員
|
||||
DRONE_USER_CREATE: "username:admin,admin:true"
|
||||
# Webhook 密鑰設定(必須和 Gitea Webhook 設定一致)
|
||||
DRONE_WEBHOOK_SECRET: a1212416fb0515155c2c88f00a7879ad
|
||||
# Gitea 配置 - 連接到本機 Gitea 服務
|
||||
DRONE_GITEA_SERVER: http://git.karylab.com
|
||||
DRONE_GITEA_CLIENT_ID: ${GITEA_DRONE_CLIENT_ID:-drone_client}
|
||||
DRONE_GITEA_CLIENT_SECRET: ${GITEA_DRONE_SECRET:-drone_secret}
|
||||
volumes:
|
||||
- drone_data:/data
|
||||
networks:
|
||||
- docker-registry-network
|
||||
- gitea_gitea-net
|
||||
- webproxy
|
||||
depends_on:
|
||||
- registry
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:80/api/version"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
|
||||
# 6. Drone Runner - Docker 執行器,使用 DinD 編譯並自動清理
|
||||
drone-runner:
|
||||
@@ -145,8 +146,8 @@ services:
|
||||
DRONE_CLEANUP: "true"
|
||||
# 編譯完後自動刪除容器
|
||||
DRONE_DOCKER_PURGE: "true"
|
||||
DRONE_UI_USERNAME: admin
|
||||
DRONE_UI_PASSWORD: admin
|
||||
DRONE_UI_USERNAME: ${REGISTRY_USERNAME}
|
||||
DRONE_UI_PASSWORD: ${REGISTRY_PASSWORD}
|
||||
networks:
|
||||
- docker-registry-network
|
||||
depends_on:
|
||||
@@ -158,7 +159,13 @@ volumes:
|
||||
build_cache:
|
||||
# Drone CI 配置和數據
|
||||
drone_data:
|
||||
# Registry 垃圾回收日誌
|
||||
registry_gc_logs:
|
||||
|
||||
networks:
|
||||
docker-registry-network:
|
||||
driver: bridge
|
||||
gitea_gitea-net:
|
||||
external: true
|
||||
webproxy:
|
||||
external: true
|
||||
|
||||
@@ -31,6 +31,8 @@ services:
|
||||
- GITEA__database__PASSWD=${POSTGRES_PASSWORD}
|
||||
# 啟用 Actions (關鍵設定)
|
||||
- GITEA__actions__ENABLED=true
|
||||
# 允許發送 webhook 到內部 IP
|
||||
- GITEA__webhook__ALLOWED_HOST_LIST=*
|
||||
networks:
|
||||
- gitea-net
|
||||
- webproxy
|
||||
@@ -88,7 +90,6 @@ volumes:
|
||||
networks:
|
||||
gitea-net:
|
||||
driver: bridge
|
||||
|
||||
# npm bridge
|
||||
webproxy:
|
||||
external: true
|
||||
Reference in New Issue
Block a user