docker_practice/cases/ci/drone/install.md

88 lines
2.1 KiB
Go
Raw Normal View History

# Drone
##
* IP (使 Gogs + Drone)
* SSL ()
* `Docker` `Docker Compose`
* `Git`
* `CI/CD`
## GitHub
GitHub https://github.com/settings/applications/new 新建一个应用。
![](https://docs.drone.io/screenshots/github_application_create.png)
`Client ID` `Client Secret` Drone
## Drone
使 `Docker Compose` `Drone` `docker-compose.yml`
```yaml
version: '3'
services:
drone-server:
image: drone/drone:1
ports:
- 443:443
- 80:80
volumes:
- drone-data:/data:rw
- ./ssl:/etc/certs
restart: always
environment:
- DRONE_AGENTS_ENABLED=true
- DRONE_SERVER_HOST=${DRONE_SERVER_HOST:-https://drone.yeasy.com}
- DRONE_SERVER_PROTO=${DRONE_SERVER_PROTO:-https}
- DRONE_RPC_SECRET=${DRONE_RPC_SECRET:-secret}
- DRONE_GITHUB_SERVER=https://github.com
- DRONE_GITHUB_CLIENT_ID=${DRONE_GITHUB_CLIENT_ID}
- DRONE_GITHUB_CLIENT_SECRET=${DRONE_GITHUB_CLIENT_SECRET}
drone-agent:
image: drone/drone-runner-docker:1
restart: always
depends_on:
- drone-server
volumes:
- /var/run/docker.sock:/var/run/docker.sock:rw
environment:
- DRONE_RPC_PROTO=http
- DRONE_RPC_HOST=drone-server
- DRONE_RPC_SECRET=${DRONE_RPC_SECRET:-secret}
- DRONE_RUNNER_NAME=${HOSTNAME:-demo}
- DRONE_RUNNER_CAPACITY=2
dns: 114.114.114.114
volumes:
drone-data:
```
`.env`
```bash
# drone.domain.com
DRONE_SERVER_HOST=
DRONE_SERVER_PROTO=https
DRONE_RPC_SECRET=secret
HOSTNAME=demo
# GitHub
DRONE_GITHUB_CLIENT_ID=
# GitHub
DRONE_GITHUB_CLIENT_SECRET=
```
### Drone
```bash
$ docker-compose up -d
```