获取gitea镜像
gitea/gitea:1.19.3
创建挂载的文件夹
进入/volume1/docker/文件夹创建 gitea 所需文件夹
cxloge@synocxloge:~$ cd /volume1/docker/
cxloge@synocxloge:/volume1/docker$ mkdir -p gitea/1.19.3/data
cxloge@synocxloge:~$ netstat -tunlp | grep 7300
app.ini
cxloge@synocxloge:/volume1/docker/gitea/1.19.2/data/gitea/conf$ ls
app.ini
[server]
APP_DATA_PATH = /data/gitea
DOMAIN = xxx.xxx.31.37
SSH_DOMAIN = xxx.xxx.31.37
HTTP_PORT = 3000
ROOT_URL = http://xxx.xxx.31.37:7300/
DISABLE_SSH = false
SSH_PORT = 7022
SSH_LISTEN_PORT = 22
LFS_START_SERVER = true
LFS_JWT_SECRET =
OFFLINE_MODE = true
[database]
PATH = /data/gitea/gitea.db
DB_TYPE = postgres
HOST = xxx.xxx.31.37:15432
NAME = gitea
USER = gitea
PASSWD = gitea
LOG_SQL = false
SCHEMA =
SSL_MODE = disable
CHARSET = utf8
docker-cli.sh
docker-compose.yml
cat > docker-compose.yml <<-EOF
version: "3"
networks:
gitea:
external: false
services:
server:
image: gitea/gitea:1.19.3
container_name: gitea-7300
environment:
- USER_UID=1000
- USER_GID=1000
restart: always
networks:
- gitea
volumes:
- ./data:/data
ports:
- "7300:3000"
- "7022:22"
EOF
根据已编排好的docker-compose.yml启动容器docker-compose up -d
root@synocxloge:/volume1/docker/gitea/1.19.2# docker-compose up -d
service "server" refers to undefined network gitea: invalid compose project
# docker-compose.yml缺少以下networks配置
# networks:
# gitea:
# external: false
root@synocxloge:~# cd /volume1/docker/gitea/1.19.2
root@synocxloge:/volume1/docker/gitea/1.19.2# ls
data docker-compose.yml
root@synocxloge:/volume1/docker/gitea/1.19.2# docker-compose up -d
service "server" refers to undefined network gitea: invalid compose project
root@synocxloge:/volume1/docker/gitea/1.19.2# docker-compose up -d
[+] Running 2/2
⠿ Network 1192_gitea Created 1.7s
⠿ Container gitea-7300 Started 6.9s
root@synocxloge:/volume1/docker/gitea/1.19.2# docker ps | grep gitea
960ddd5f80cc gitea/gitea:1.19.3 "/usr/bin/entrypoint…" 28 seconds ago Up 21 seconds 0.0.0.0:7022->22/tcp, :::7022->22/tcp, 0.0.0.0:7300->3000/tcp, :::7300->3000/tcp gitea-7300
root@synocxloge:/volume1/docker/gitea/1.19.2#
README.md渲染显示不正常
渲染显示不正常 | 渲染正常 |
---|---|
配置Alpine源镜像
960ddd5f80cc:/# uname -a
Linux 960ddd5f80cc 4.4.302+ #64570 SMP Tue Jun 13 21:40:17 CST 2023 x86_64 Linux
960ddd5f80cc:/# cat /etc/issue
Welcome to Alpine Linux 3.17
Kernel \r on an \m (\l)
960ddd5f80cc:/# cp -a /etc/apk/repositories /etc/apk/repositories.bak
960ddd5f80cc:/# cd /etc/apk/
960ddd5f80cc:/etc/apk# ls
arch keys protected_paths.d repositories repositories.bak world
960ddd5f80cc:/etc/apk# vi repositories
960ddd5f80cc:/etc/apk# cat repositories
# https://dl-cdn.alpinelinux.org/alpine/v3.17/main
# https://dl-cdn.alpinelinux.org/alpine/v3.17/community
https://repo.huaweicloud.com/alpine/v3.17/main
https://repo.huaweicloud.com/alpine/v3.17/community
执行apk update
更新索引,执行apk search xxx查询软件包,执行apk install xxx安装软件包`
华为开源镜像站_Alpine 使用说明 https://mirrors.huaweicloud.com/mirrorDetail/5ea14e7b02ea0eda6bd1e8fa
安装外部二进制文件
apk --no-cache add asciidoctor freetype freetype-dev gcc g++ libpng libffi-dev py-pip python3-dev py3-pip py3-pyzmq
# 官网安装脚本少了pandoc,无所谓后面安装也是可以的,只是需要多花点时间啦
# 配置pypi镜像
960ddd5f80cc:~# pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple/
Writing to /root/.config/pip/pip.conf
# 安装其他您需要的外部渲染器的软件包
pip3 install --upgrade pip
pip3 install -U setuptools
pip3 install jupyter docutils
# 在上面添加您需要安装的任何其他 Python 软件包
重启container,刷新页面,README.md还是没有渲染出来,分析了以下运行log,发现了pandoc还没有安装,于是进入container内部终端apk add pandoc
2023/07/10 16:05:59 ...ers/web/repo/view.go:321:renderReadmeFile() [E] [64ac2c67] Render failed for README.md in 151:termux/termux-packages: markdown render run command pandoc [-f markdown -t html --katex] failed: exec: "pandoc": executable file not found in $PATH,
Stderr: Falling back to rendering source,
2023/07/10 16:06:00 [64ac2c67] router: completed GET /termux/termux-packages for 172.23.0.1:47216, 200 OK in 143.8ms @ repo/view.go:703(repo.Home),
安装完成pandoc,刷新页面README.md正常显示了,完成了.
参考链接
使用 Docker 安装 | Gitea 官方文档
https://docs.gitea.cn/installation/install-with-docker
外部渲染器 | Gitea 官方文档
https://docs.gitea.cn/administration/external-renderers