其他分享
首页 > 其他分享> > gitea和drone配置ci

gitea和drone配置ci

作者:互联网

配置过程如下

 

gitea.yml

version: "3"

services:
  server:
    image: gitea/gitea:1.15.6
    container_name: gitea
    environment:
      - USER_UID=1000
      - USER_GID=1000
    restart: always
    volumes:
      - ./gitea_data:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3000:3000"
      - "222:22"

运行

docker-compose -f gitea.yml up -d

 

打开

http://192.168.0.24:3000
设置 -> 应用 -> 创建OAuth2 应用 -> 重定向uri
http://192.168.0.24:9080/login
客户端id和客户端密钥会自动生成,保存起来

 

生成rpc密钥

openssl rand -hex 16

 

配置drone, 修改 drone.yml

version: "3"
services:
  fan-drone-server:
    image: drone/drone:2.4.0
    ports:
      - 9080:80
      - 9443:443
    volumes:
      - ./drone_data:/data
    restart: always
    environment:
      - DRONE_GITEA_SERVER=http://主机IP:3000
      - DRONE_GITEA_CLIENT_ID=客户端id
      - DRONE_GITEA_CLIENT_SECRET=客户端密钥
      - DRONE_RPC_SECRET=rpc密钥
      - DRONE_SERVER_HOST=192.168.0.24:9080
      - DRONE_SERVER_PROTO=http
      - DRONE_USER_CREATE=username:root,admin:true

  fan-docker-runner:
    image: drone/drone-runner-docker:linux-amd64
    ports:
      - 9030:3000
    restart: always
    depends_on:
      - fan-drone-server
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DRONE_RPC_PROTO=http
      - DRONE_RPC_HOST=主机IP:9080
      - DRONE_RPC_SECRET=rpc密钥
      - DRONE_RUNNER_CAPACITY=2
      - DRONE_RUNNER_NAME=fan-docker-runner-1

 

测试

往仓库里面 添加 .drone.yml

kind: pipeline
type: docker
name: default
   
steps:
- name: test
  image: alpine
  commands:
  - echo hello
  - echo world

push任意代码,会触发构建行为

 

标签:ci,http,gitea,drone,DRONE,3000,docker
来源: https://www.cnblogs.com/ziyouchutuwenwu/p/15527780.html