forked from Pryaxis/TShock
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finish up docker docs and fix docker non-buildx builds
- Loading branch information
1 parent
108b199
commit 298f277
Showing
2 changed files
with
55 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,45 @@ | ||
# Docker Setup | ||
|
||
## Build Image: | ||
`docker build -t tshock .` | ||
## and run: | ||
In order to run TShock in a docker container, you would need to have mountpoints for | ||
- `/tshock` (TShock config files, logs and crash reports) | ||
- `/worlds` | ||
- `/plugins` | ||
- `/server` (optional, if you want to mount TShock's cwd) | ||
|
||
These folders can be mounted using `-v <host_folder>:<container>` | ||
|
||
Open ports can also be passed through using `-p <host_port>:<container_port>`. | ||
- `7777` for Terraria | ||
- `7878` for TShock's REST API | ||
|
||
For Example: | ||
```bash | ||
# Building the image | ||
docker build -t tshock:linux-x64 --build-arg TARGETPLATFORM=linux-x64 . | ||
|
||
# Running the image | ||
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-x64 \ | ||
-world /worlds/backflip.wld -motd "OMFG DOCKER" | ||
``` | ||
|
||
## Building for Other Platforms | ||
|
||
Using `docker buildx`, you could build [multi-platform images](https://docs.docker.com/build/building/multi-platform/) for TShock. | ||
|
||
For Example: | ||
```bash | ||
# Building the image using buildx and loading it into docker | ||
sudo docker buildx build -t tshock:linux-arm64 --platform linux/arm64 --load . | ||
|
||
# Running the image | ||
docker run -p 7777:7777 -p 7878:7878 \ | ||
-v <save path>:/tshock \ | ||
-v <world path>:/worlds \ | ||
-v <plugin path>:/plugins \ | ||
--rm -it tshock [-world /worlds/<world file>] <other cmdline flags> | ||
-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" | ||
``` |