使用 docker.io 或其他镜像服务来提供(但不限于) gcr.io、registry.k8s.io、k8s.gcr.io、quay.io、ghcr.io 等国外镜像加速下载服务
为减少重复请求,合理利用资源,建议提前在 issues 搜索镜像是否已转换过
示例:issues搜索gcr.io/google-samples/microservices-demo/emailservice:v0.3.5
当任务失败时,可以查看具体失败原因并修改 issues 主体内容,无需新建 issues
限制:每次提交最多 11 个镜像地址(为啥是11个?因为我的第一次需求刚好要转换11个镜像🤣)
本人 Docker 账号有每日镜像拉取限额,请勿滥用
-
绑定账号
-
如果要使用 DockerHub 的镜像服务
在
Settings-Secrets-Actions选择New repository secret新建DOCKER_USERNAME(你的 Docker 用户名) 和DOCKER_TOKEN(你的 Docker 密码) 两个 Secrets -
如果需要使用其他镜像服务,例如腾讯云、阿里云等
在
Settings-Secrets-Actions选择New repository secret新建DOCKER_USERNAME(你的其他镜像服务用户名) 和DOCKER_TOKEN(你的其他镜像服务密码)以及DOCKER_REPOSITORY三个 Secrets其中
DOCKER_REPOSITORY配置例子:- 腾讯云:
ccr.ccs.tencentyun.com/xxxxxx - 阿里云:
registry.cn-hangzhou.aliyuncs.com/xxxxxx - 等其他云...
- 腾讯云:
-
-
在 Fork 的项目中开启
Settings-General-Features中的Issues功能 -
在 Fork 的项目中修改
Settings-Actions-General中的Workflow permissions为Read and write permissions -
在
Issues-Labels选择New label依次添加三个 label :hub-mirror、success、failure -
在
Actions里选择hub-mirror,在右边···菜单里选择Enable Workflow
$ go install github.com/togettoyou/hub-mirror@latest$ hub-mirror --username=xxxxxx --password=xxxxxx --content='{ "hub-mirror": ["gcr.io/google-samples/microservices-demo/emailservice:v0.3.5","hello-world:latest"] }'
# 如果需要使用自定义镜像仓库
$ hub-mirror --username=xxxxxx --password=xxxxxx --repository=registry.cn-hangzhou.aliyuncs.com/xxxxxx --content='{ "hub-mirror": ["gcr.io/google-samples/microservices-demo/emailservice:v0.3.5","hello-world:latest"] }'