docker-compose安装gitea及配置
version: "3"
networks:
gitea:
external: false
services:
server:
image: gitea/gitea:1.15.7
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
networks:
- gitea
volumes:
- ./gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "222:22"
depends_on:
- db
db:
image: mysql:8
restart: always
environment:
- MYSQL_ROOT_PASSWORD=gitea
- MYSQL_USER=gitea
- MYSQL_PASSWORD=gitea
- MYSQL_DATABASE=gitea
networks:
- gitea
volumes:
- ./mysql:/var/lib/mysql
启动
docker-compose up -d
http://ip:3000访问 gitea官网
配置邮箱
1.开启SMTP
以qq邮箱为例,邮箱需要先开启smtp 此时需要发送短信然后生成一个码,该码及邮箱的密码
2. 修改邮箱配置
配置参考官网配置即可
第一次配置错误导致无法发送邮件,可以修改配置重启服务,下面以docker为例
# 进入docker容器
docker exec -it gitea /bin/bash
# 进入配置目录
cd /data/gitea/conf
# 修改配置
vi app.ini
3. 验证能否发送邮件
4. 注册账号激活