version: '3'
services:
  gogs:
    container_name: gogs
    image: gogs/gogs:latest
    ports:
      - ${GOGS_PORT:-3010}:3000
    volumes:
      - ./.data/gogs/data:/data
    environment:
      - TZ=Asia/Shanghai
    restart: always

  drone-server:
    image: drone/drone:latest
    container_name: drone-server
    ports:
      - ${DRONE_SERVER_PORT:-8010}:80
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./.data/drone/:/var/lib/drone
    environment:
      - DRONE_OPEN=true
      - DRONE_SERVER_HOST=${DRONE_SERVER_IP}:${DRONE_SERVER_PORT:-8010}
      - DRONE_DEBUG=true
      - DRONE_GIT_ALWAYS_AUTH=false
      - DRONE_GOGS=true
      - DRONE_GOGS_SKIP_VERIFY=false
      - DRONE_GOGS_SERVER=http://192.168.1.96:3010
      - DRONE_PROVIDER=gogs
      - DRONE_SERVER_PROTO=http
      - DRONE_RPC_SECRET=123456
      - DRONE_USER_CREATE=username:${DRONE_ADMIN},admin:true
      - DRONE_DATABASE_DATASOURCE=/var/lib/drone/drone.sqlite
      - DRONE_DATABASE_DRIVER=sqlite3
      - TZ=Asia/Shanghai
    restart: always

  drone-agent:
    image: drone/agent:latest
    container_name: drone-agent
    depends_on:
      - drone-server
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DRONE_RPC_SERVER=drone-server:9000
      - DRONE_RPC_SECRET=123456
      - DRONE_RUNNER_CAPACITY=${DRONE_RUNNER_CAPACITY:-2}
      - DRONE_DEBUG=true
      - TZ=Asia/Shanghai
    restart: always