一、环境准备
- 安装Docker和Docker-compose
- 项目采用Docker Compose文件部署
- docker-compose.yml
version: "3"
networks:
dev:
external: false
services:
gitea:
image: gitea/gitea:1.19
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__database__DB_TYPE=mysql
- GITEA__database__HOST=mysql8:3306
- GITEA__database__NAME=gitea
- GITEA__database__USER=gitea
- GITEA__database__PASSWD=gitea
# restart: always
volumes:
- ./gitea/data:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "2222:22"
depends_on:
- mysql8
mysql8:
image: mysql:8
container_name: mysql8
# restart: always
environment:
- MYSQL_ROOT_PASSWORD=gitea
- MYSQL_USER=gitea
- MYSQL_PASSWORD=gitea
- MYSQL_DATABASE=gitea
volumes:
- ./mysql8/data:/var/lib/mysql
drone-server:
image: drone/drone:2
container_name: drone-server
volumes:
- ./data:/data
- /etc/localtime:/etc/localtime
environment:
- DRONE_SERVER_HOST=http://localhost:
- DRONE_SERVER_PROTO=https
- DRONE_GIT_ALWAYS_AUTH=true
- DRONE_LOGS_TRACE=true
- DRONE_DEBUG=true
- DRONE_LOGS_DEBUG=true
- DRONE_RPC_SECRET=897e84765698133a813b39de6fc7a04a
- DRONE_GITEA_SERVER=http://git.jmu.edu.cn
- DRONE_GITEA_CLIENT_ID=08af12ea-8f87-457b-aa9a-967819f4b828
- DRONE_GITEA_CLIENT_SECRET=gto_b5iutusqouceosaev27rwhaylclr3mkyu5e6zofqaj6jt436dy6q
- DRONE_USER_CREATE=username:jiasen,admin:true
# restart: always
# extra_hosts:
# - "git.naivekun.home:192.168.2.233"
# - "drone.naivekun.home:192.168.2.233"
drone-runner-docker:
image: drone/drone-runner-docker:latest
container_name: drone-runner-docker
depends_on:
- drone-server
environment:
- DRONE_LOGS_DEBUG=true
- DRONE_RPC_HOST=drone-server
- DRONE_RPC_PROTO=http
- DRONE_RPC_SECRET=897e84765698133a813b39de6fc7a04a
- DRONE_RUNNER_NAME=drone-runner-docker
- DRONE_LOGS_TRACE=true
- DRONE_DEBUG=true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /etc/localtime:/etc/localtime
#restart: always
二、Gitea
1.yml配置
gitea:
image: gitea/gitea:1.19
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__database__DB_TYPE=mysql
- GITEA__database__HOST=mysql8:3306
- GITEA__database__NAME=gitea
- GITEA__database__USER=gitea
- GITEA__database__PASSWD=gitea
# restart: always
volumes:
- ./gitea/data:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "2222:22"
depends_on:
- mysql8
2.初始配置
3.配置Oauth2令牌
- 保存客户端id和密钥
三、Drone
jmu-drone
appid:
d9e4b5ddf4ede0398f70ac3732c976d9a7dd6393f111269136de150ce0eff26c
appsecret:
c54a07b89f9e0905adb32b0f6c9e725d3c1404cd127241285f13d250a9244c1d
[root@localhost drone]# openssl rand -hex 16
d4ef72ebcd94d3aa012c79d76170080f
...