This is heavily inspired by screeps-launcher's climod.
Spin up the Docker container:
docker compose up -d
Then try using curl to post a command:
docker compose run curl -X POST http://localhost:21028/cli -d 'help()'
If you want to be able to access the CLI endpoint from outside the container, set the host to 0.0.0.0
in your config (and make sure the port is exposed in your docker-compose):
cli:
host: 0.0.0.0
port: 21028
Then you can call it directly:
curl -X POST http://localhost:21028/cli -d 'help()'
To pass in a script (note the response will only include the return value of the last command):
curl -X POST http://localhost:21028/cli -d '@testScript.js'