mirror of
https://github.com/Pryaxis/TShock.git
synced 2025-12-16 01:04:58 +00:00
Page:
(中文)docker
Pages
(Esp) Descripción del archivo de configuración
(Esp) Parámetros de la línea de comandos
(中文)REST端点
(中文)docker
(中文)i18n
(中文)主配置(config.json)
(中文)主页
(中文)命令行参数
(中文)地图读写接口
(中文)插件
(中文)服务端角色(SSC)
(中文)服务端角色配置(sscconfig.json)
(中文)权限说明
(中文)欢迎消息(motd.txt)
(中文)语言
(中文)软件包
.
Changelog
Command line parameters
Home
Plugins
config file descriptions
docker
i18n
lang
motd
packages
permission descriptions
rest fields
ssc config
ssc
tile providers
No results
Table of Contents
This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Docker 设置
为了在 Docker 容器中运行 TShock,您需要为以下目录设置挂载点:
/tshock(TShock 配置文件、日志和崩溃报告)/worlds/plugins/server(可选,如果您想挂载 TShock 的工作目录)
这些文件夹可以使用 -v <主机文件夹>:<容器路径> 进行挂载
开放端口也可以使用 -p <主机端口>:<容器端口> 传递。
7777用于 Terraria7878用于 TShock 的 REST API
例如:
# 使用 buildx 构建镜像并加载到 docker 中
docker buildx build -t tshock:latest --load .
# 运行镜像
docker run -p 7777:7777 -p 7878:7878 \
-v /home/cider/tshock/:/tshock \
-v /home/cider/.local/share/Terraria/Worlds:/worlds \
-v /home/cider/tshock/plugins:/plugins \
--rm -it tshock:latest \
-world /worlds/backflip.wld -motd "OMFG DOCKER"
为其他平台构建
使用 docker buildx,您可以为 TShock 构建多平台镜像。
例如:
# 使用 buildx 构建镜像并加载到 docker 中
docker buildx build -t tshock:linux-arm64 --platform linux/arm64 --load .
# 运行镜像
docker run -p 7777:7777 -p 7878:7878 \
-v /home/cider/tshock/:/tshock \
-v /home/cider/.local/share/Terraria/Worlds:/worlds \
-v /home/cider/tshock/plugins:/plugins \
--rm -it tshock:linux-arm64 \
-world /worlds/backflip.wld -motd "ARM64 ftw"
使用 Docker Compose
如果您已安装 Docker Compose,您可以跳过显式构建镜像,而是使用如下的 docker-compose.yml 文件:
services:
terraria:
build:
context: https://github.com/Pryaxis/TShock.git
args:
TARGETPLATFORM: linux/amd64
container_name: terraria
restart: unless-stopped
volumes:
- "./tshock/:/tshock"
- "./worlds:/worlds"
- "./plugins:/plugins"
- "/etc/localtime:/etc/localtime:ro"
ports:
- "7777:7777"
- "7878:7878" # 如果您不使用 REST 服务,可以删除此项
command: -world /worlds/my_world.wld
要以交互方式运行服务器(例如生成世界),请使用 docker compose run --rm terraria(暂时不使用 command:)。
然后,您可以使用 docker compose up -d 在后台运行它,并让它随您的主机系统自动重启。
下载官方镜像
TShock 会为每次提交自动发布镜像。您也可以使用来自 nuget 的最新发布/发行版本。通过使用 nuget-release 标签,您实际上引用的是 TShock 的最新稳定版本。通过使用 general-devel,您实际上拥有了 TShock 的最新开发版本。我们还会自动为所有发布版本打上标签,例如 5.2.4 是一个有效的标签。