Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Compose example #2991

Open
wants to merge 2 commits into
base: general-devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Use past tense when adding new entries; sign your name off when you add or chang
* Added a property `TSPlayer.Hostile`, which gets pvp player mode. (@AgaSpace)
* Fixed typo in `/gbuff`. (@sgkoishi, #2955)
* Rewrote the `.dockerignore` file into a denylist. (@timschumi)
* Added an example Docker Compose script which doesn't require building TShock manually. (@ramidzkh)

## TShock 5.2
* An additional option `pvpwithnoteam` is added at `PvPMode` to enable PVP with no team. (@CelestialAnarchy, #2617, @ATFGK)
Expand Down
28 changes: 28 additions & 0 deletions docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,31 @@ docker run -p 7777:7777 -p 7878:7878 \
--rm -it tshock:linux-arm64 \
-world /worlds/backflip.wld -motd "ARM64 ftw"
```

## Using Docker Compose

If you have [Docker Compose](https://docs.docker.com/compose/) installed, you can skip building the image explicitly, and rather use a `docker-compose.yml` file like so:
```yml
version: "3"

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" # can be removed if you don't use the REST service
command: -world /worlds/my_world.wld
```

To run the server interactively, for example to generate a world, use `docker compose run --rm terraria` (without the `command:` for now).
Then, you can use `docker compose up -d` to run it in the background, and have it automatically restart with your host system.