version: '3.8'

services:
  gitea:
    image: gitea/gitea:latest
    container_name: rent-gitea
    restart: always
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - GITEA__server__ROOT_URL=http://localhost:3002/
      - GITEA__server__HTTP_PORT=3000
      - GITEA__server__SSH_PORT=2222
      - GITEA__server__SSH_LISTEN_PORT=2222
    ports:
      - "3002:3000"
      - "2222:2222"
    volumes:
      - gitea_data:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    networks:
      - gitea

  act-runner:
    image: gitea/act_runner:latest
    container_name: rent-act-runner
    restart: always
    depends_on:
      - gitea
    environment:
      - GITEA_INSTANCE_URL=http://gitea:3000
      # 注册后在 Gitea Web 界面获取 token，填入下面配置
      - GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_TOKEN:-change_me}
      - GITEA_RUNNER_NAME=rent-deploy-runner
      - GITEA_RUNNER_LABELS=self-hosted,rent-deploy
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - act_runner_data:/data
    networks:
      - gitea

volumes:
  gitea_data:
  act_runner_data:

networks:
  gitea:
    name: gitea
