[Unit]
Description=Modded Minecraft Server via Podman managed by Systemd
Documentation=https://git.nanody.de/anonoe/MMS
Wants=velocity.service
After=velocity.service

[Container]
Image=git.nanody.de/anonoe/jre-alpine:latest
AutoUpdate=registry
PublishPort=25566:25565/tcp
PublishPort=24455:24455/udp
UserNS=keep-id
Mount=type=bind,src=/PATH/TO/server,dst=/mnt/server
Mount=type=bind,src=/PATH/TO/rcon,dst=/mnt/rcon
WorkingDir=/mnt/server
PodmanArgs=--tty --interactive
Exec=java -Xmx4G -Xms1G -jar minecraft_server.jar --nogui

[Service]
SuccessExitStatus=0 143
TimeoutStartSec=480
TimeoutStopSec=480
ExecStop=-podman exec systemd-MMS sh /mnt/rcon/stop.sh

[Install]
# Start by default on boot
WantedBy=default.target
