# gitea + drone + drone runner + registry 作为 git 服务器，自动测试、构建和打包镜像并发布到私有仓库

## gitea ssh 密钥

1. 执行：sh-keygen -t ed25519 -C "youname@domain.com" 生成：%USERNAME%/.ssh/id_ed25519.pub
1. 配置：http://10.10.14.176:3000/user/settings/keys 添加id_ed25519.pub内容作为key

## docker compose 显式配置网络后才能访问到宿主机 ip
```
networks:
    default:
        name: mynetwork
        driver: bridge
        ipam:
            config:
                - subnet: 172.172.0.0/24
```

## 修改docker配置使用镜像和私有http仓库
修改 /etc/docker/daemon.json 文件的 registry-mirrors 和 insecure-registries属性
```
{
  "registry-mirrors": [
    "https://registry.docker-cn.com",
    "http://hub-mirror.c.163.com",
    "https://docker.mirrors.ustc.edu.cn"
  ],
  "insecure-registries": ["10.10.14.176:5000"]
}
```
systemctl daemon-reload
systemctl restart docker
docker info

## 其他

1. https://docs.drone.io/pipeline/docker/examples/
1. drone 环境变量：https://github.com/drone/drone/blob/master/operator/runner/env.go
1. 邮件通知：http://plugins.drone.io/drillster/drone-email/