Initial commit: Gitea Docker setup

This commit is contained in:
2026-03-09 12:34:55 +08:00
commit 85a98858f1
4 changed files with 73 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
data/

46
README.md Normal file
View File

@@ -0,0 +1,46 @@
# Gitea Docker Setup
使用 Docker Compose 運行 Gitea Git 服務器。
## 服務訪問
- **Web 界面**: http://localhost:3000
- **SSH Git**: localhost:222
## 常用命令
```bash
# 啟動服務
./start.sh
# 停止服務
docker-compose down
# 查看日誌
docker-compose logs -f
# 重啟服務
docker-compose restart
```
## 數據存儲
所有 Gitea 數據存儲在 `./data` 目錄下,包含:
- Git repositories
- 數據庫(默認使用 SQLite
- 配置文件
- 用戶上傳的文件
## 首次設置
1. 啟動服務後訪問 http://localhost:3000
2. 選擇數據庫類型SQLite3
3. 設置管理員帳號
4. 完成!
## 備份
定期備份 `./data` 目錄即可:
```bash
tar -czf gitea-backup-$(date +%Y%m%d).tar.gz data/
```

21
docker-compose.yml Normal file
View File

@@ -0,0 +1,21 @@
networks:
gitea:
external: false
services:
server:
image: gitea/gitea:latest
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
restart: always
networks:
- gitea
volumes:
- ./data:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "222:22"

5
start.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
docker-compose up -d
echo "Gitea 已啟動!"
echo "Web 界面: http://localhost:3000"
echo "SSH Git: localhost:222"