What is theDrone CI
If you don’t want to, search for it yourself. It can be used as a CI starter, easy to deploy and powerful.
Environment to prepare
- Gitea private server (also can use other, Github, Gogs, etc., I use Gitea)
- Docker and Docker Compose
Start the deployment
- Create a new application in Gitea
Operation process:
- Click on your picture in the upper right corner
- Choose to apply
- Create a new OAuth2 application, name whatever, redirect URL write
http://domain name set in yML below /login
- Save and record the client ID and key, which will be used next
- create
docker-compose.yml
version: '3'
services:
drone-server:
container_name: drone-server
image: drone/drone:latest
restart: always
environment:
- DRONE_GITEA_SERVER= GitEA service address
- DRONE_GITEA_CLIENT_ID= ID of the client generated after the previous step is created
- DRONE_GITEA_CLIENT_SECRET= Client key generated after the previous step
- DRONE_GIT_ALWAYS_AUTH=false
- DRONE_GITEA_SKIP_VERIFY=true
- DRONE_RUNNER_CAPACITY=2
- DRONE_SERVER_PROTO=http
- DRONE_SERVER_HOST=drone's domain name, also available ip:port Is the same as the domain name part of the redirect URL entered in the first step
- DRONE_TLS_AUTOCERT=false
- DRONE_NETWORK=cicd_default
- DRONE_RUNNER_NETWORKS=cicd_default
# This key is for runner
- DRONE_RPC_SECRET=Mu4Z1A9QgjOVEkyI
- DRONE_AGENTS_ENABLED=true
ports:
Console page port
- "8000:80"
volumes:
- /data/drone:/data
drone-runner:
container_name: drone-runner
image: drone/drone-runner-docker:latest
restart: always
depends_on:
- drone-server
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- DRONE_RPC_PROTO=http
If you want to use this configuration directly, there is no need to change it. If you want to deploy to another server, you need to enter the domain name of the server
- DRONE_RPC_HOST=drone-server
# server configuration DRONE_RPC_SECRET
- DRONE_RPC_SECRET=Mu4Z1A9QgjOVEkyI
- DRONE_RUNNER_CAPACITY=2
- DRONE_RUNNER_NAME=drone-runner
- DRONE_RPC_SKIP_VERIFY=true
The following comment is the runner's console, there is no need to add, server can see directly
# - DRONE_UI_USERNAME=root
# - DRONE_UI_PASSWORD=root
# ports:
# - 3000:3000
Copy the code
- Start the service
docker-compose up -d
- If there are no errors, you have started successfully
How to use
You can create a.drone.yml file in the project. Please refer to the official document or search online