PythonMC is a Fabric mod that allows datapacks to be written in Python. Minecraft datapacks have some big limitations but, PythonMC has very little. Like for loops, functions, if statements, and ...
Create a systemd service (or run the Docker command from the command line) somewhere, setting the MINECRAFT_SERVER_HOST and optionally MINECRAFT_SERVER_PORT addresses ...