docker安装gitea
  docker-compose.yml
version: "3"
services:
  server:
    image: gitea/gitea:latest
    container_name: gitea
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - DB_TYPE=mysql
      - DB_HOST=db:3306
      - DB_NAME=gitea
      - DB_USER=gitea
      - DB_PASSWD=gitea
    restart: always
    volumes:
      - /opt/gitea/data:/data                   # 数据持久化目录
      - /etc/timezone:/etc/timezone:ro  # 同步时区
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3000:3000"
      - "2222:22"
    depends_on:
      - db
  db:
    image: mysql:8.0
    container_name: mysql8
    environment:
      MYSQL_ROOT_PASSWORD: gitea
      MYSQL_USER: gitea
      MYSQL_PASSWORD: gitea
      MYSQL_DATABASE: gitea
    volumes:
      - "/opt/gitea/mysql/data:/var/lib/mysql"   # MySQL 数据持久化
    ports:
      - "33306:3306"   # HTTP 服务端口
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
编辑  (opens new window)
  上次更新: 2025/06/10, 09:18:05