没有废话直接上代码
version: "3"
services:
drone-server:
image: drone/drone:2.4
container_name: drone_server
ports:
- 10081:80
networks:
- dronenet
volumes:
- ./drone/data:/var/lib/drone/:rw
- /var/run/docker.sock:/var/run/docker.sock:rw
restart: always
environment:
- DRONE_DEBUG=true
- DRONE_DATABASE_DATASOURCE=root:passwd@tcp(you-ip:3306)/drone?parseTime=true #mysql配置,要与上边mysql容器中的配置一致
- DRONE_DATABASE_DRIVER=mysql
- DRONE_GOGS=true
- DRONE_GOGS_SERVER=http://you-ip:3000
- DRONE_PROVIDER=gogs
- DRONE_RPC_SECRET=miyao#RPC秘钥
- DRONE_SERVER_PROTO=http #这个配置决定了你激活时仓库中的webhook地址的proto
- DRONE_SERVER_HOST=you-ip:10081
- DRONE_USER_CREATE=username:admin,admin:true #管理员账号,一般是你github用户名
drone-agent:
image: drone/agent:latest
container_name: drone_agent
restart: always
networks:
- dronenet
depends_on:
- drone-server #依赖drone_server,并在其后启动
volumes:
- /var/run/docker.sock:/var/run/docker.sock:rw
environment:
- DRONE_RPC_SERVER=you-ip:10081 #drone用的http请求包,url一定要写上协议才能支持
- DRONE_RPC_SECRET=miyao#RPC秘钥,要与drone_server中的一致
- DRONE_DEBUG=true
drone-runner:
image: drone/drone-runner-docker:latest
container_name: drone_runner-docker
restart: always
ports:
- 10082:3000
networks:
- dronenet
volumes:
- /var/run/docker.sock:/var/run/docker.sock:rw
environment:
- DRONE_RPC_PROTO=http
- DRONE_RPC_HOST=you-ip:10081
- DRONE_RPC_SECRET=miyao
- DRONE_DEBUG=true
gogs:
container_name: drone_gogs
image: gogs/gogs
restart: always
ports:
- 3000:3000
- "3022:22"
networks:
dronenet:
networks:
dronenet: