drone CI工具实现外部配置文件拉取私有镜像

发布时间 2023-05-07 23:40:25作者: 辉辉、
drone:
    image: drone/drone
    environment:
      - DRONE_GITEA_SERVER=http://xxx:13000
      - DRONE_GITEA_CLIENT_ID=a2a16b95-4ea4-43ff-a3da-b18260acd8b0
      - DRONE_GITEA_CLIENT_SECRET=gto_dt3xg3jcgcscift4mdhtqljzhb7qphsc3doalve5w55bpllvrp4a
      - DRONE_RPC_SECRET=11e8a665ecf9ad8f4c5592a478149598
      - DRONE_SERVER_HOST=xxx:18074
      - DRONE_SERVER_PROTO=http
      - DRONE_USER_CREATE=username:xxx,admin:true
      - DRONE_DEBUG=true
      - DRONE_LOG_LEVEL=debug
    restart: always
    volumes:
      - ./drone:/data
      - /www/go:/go
    ports:
      - 443:443
      - 18074:80
  registry:
    image: drone/registry-plugin
    environment:
      - DRONE_DEBUG=true
      - DRONE_SECRET=qwew45qe412321372dwqdwq
      - DRONE_CONFIG_FILE=/opt/auths.yml
    ports:
      - 3030:3000
    volumes:
      - /www/drone/registry_config.yml:/opt/auths.yml
  runner:
    image: drone/drone-runner-docker
    environment:
      - DRONE_DEBUG=true
      - DRONE_TRACE=true
      - DRONE_RPC_DUMP_HTTP=true
      - DRONE_RPC_DUMP_HTTP_BODY=true
      - DRONE_UI_USERNAME=jichenghui
      - DRONE_UI_PASSWORD=123456
      - DRONE_LOGS_TRACE=true
      - DRONE_LOGS_DEBUG=true
      - DRONE_RPC_PROTO=http
      - DRONE_RPC_HOST=xxx:18074
      - DRONE_RPC_SECRET=11e8a665ecf9ad8f4c5592a478149598
      - DRONE_SECRET=11e8a665ecf9ad8f4c5592a478149598
      - DRONE_REGISTRY_PLUGIN_TOKEN=qwew45qe412321372dwqdwq
      - DRONE_REGISTRY_PLUGIN_ENDPOINT=http://xxx:3030
    restart: always
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - 3000:3000

 企业的docker镜像绝不会公开,所有自动部署CI docker需要支持拉取私有镜像场景。
1.drone/registry-plugin和drone-runner-docker环境变量DRONE_SECRET相等
2.DRONE_REGISTRY_PLUGIN_ENDPOINT必须带HTTP

巨坑,还以为实现不了。差点去改drone源码。