如何搭建自己的代码托管服务器(gogs-docker搭建)
创建文件夹
mkidr -p gogs
cd gogs
docker-compose.yaml的改写
gogs:
image: docker.io/gogs/gogs:latest
links:
- mysql-gogs:mysql
ports:
- "10022:22"
- "3000:3000"
volumes:
- /opt/docker/gogs/:/data/docker/gogs
restart: always
mysql-gogs:
image: docker.io/mysql:8.0
ports:
- "3306:3306"
volumes:
- ./mysql-gogs/mysql:/var/lib/mysql
- ./mysql-gogs/conf.d:/etc/mysql/conf.d:rw
environment:
- MYSQL_DATABASE=gogs
- MYSQL_USER=gogs
- MYSQL_PASSWORD=gogs
- MYSQL_ROOT_PASSWORD=root
command: mysqld --lower_case_table_names=1 --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
restart: always
访问http://服务器ip:3000
注意数据库用户改成gogs
配置的时候主要把域名和http的ip改一下