Files
tshock/README.md

80 lines
1.9 KiB
Markdown
Raw Normal View History

2025-12-30 17:58:31 +00:00
# tshock-docker
Docker image + Compose scaffolding for **TShock v5.2.4** (Terraria **1.4.4.9**), plus a GitHub Actions workflow that builds and pushes to a custom registry (**cr.nym.sh**).
## Repo layout
- `Dockerfile` — builds the image by downloading the official TShock release asset
- `docker-compose.yml` — example: **shared** `./worlds` + **separate** per-server state under `./data/worldX`
- `.github/workflows/build-and-push.yml` — CI to build + push images to your registry
---
## Local build
```bash
docker build -t tshock:5.2.4 .
```
## Local run (two worlds, separate state)
```bash
mkdir -p worlds data/world1 data/world2
docker compose up world1 # first-time interactive prompts, Ctrl+C when done
docker compose up world2 # first-time interactive prompts, Ctrl+C when done
docker compose up -d
```
Players connect to:
- `host:7777` → world1
- `host:7778` → world2
---
## CI: push to cr.nym.sh
### 1) Create GitHub repo secrets
In your GitHub repo settings:
- `CRNYM_REGISTRY_USERNAME`
- `CRNYM_REGISTRY_PASSWORD`
These should be credentials that can push to your registry.
### 2) Set image name (optional)
By default the workflow pushes to:
`cr.nym.sh/<github-owner>/tshock`
If you want a different path/name, edit `IMAGE_NAME` in the workflow.
### 3) Triggering
The workflow runs on:
- pushes to `main`
- git tags like `v5.2.4` (recommended: tag releases)
- manual runs (workflow_dispatch)
- a weekly scheduled rebuild (useful for base image security updates)
---
## Tag strategy
- `latest` on default branch (`main`)
- `vX.Y.Z` tag pushes also publish `X.Y.Z`
- also publishes a short SHA tag for traceability
---
## Notes / gotchas
- Dont run two servers pointed at the **same** `.wld` file at once.
- Keeping `./worlds` shared is fine as long as each server uses a different world file.
- On Linux, if the container cant write to your bind mounts, you may need:
```bash
sudo chown -R 10001:10001 worlds data
```