light-run

Quick start

Install, start the server, and run your first container over HTTP.

Install

npm install -g @enixcode/light-run

A running Docker daemon is required on the host: light-run delegates execution to light-runner, which talks to Docker.

Start the server

light-run serve --port 3000 --token "$LIGHT_RUN_TOKEN"

Without --token the server starts open and prints a warning. Flags: --port, --host, --token, --body-limit. Each also has an env var (see Configuration).

Run a container

POST inline files, an image, an entrypoint, and the container paths to extract:

curl -s http://localhost:3000/run \
  -H "authorization: Bearer $LIGHT_RUN_TOKEN" \
  -H "content-type: application/json" \
  -d '{
    "image": "python:3.12-alpine",
    "entrypoint": "python main.py",
    "files": { "main.py": "open(\"/app/out.json\",\"w\").write(\"{\\\"ok\\\":true}\")" },
    "extract": ["/app/out.json"]
  }'

The response is a RunState:

{
  "id": "...",
  "status": "succeeded",
  "exitCode": 0,
  "durationMs": 1234,
  "artifacts": [{ "path": "out.json", "bytes": 13, "type": "file" }]
}

Fetch an artifact

curl -s http://localhost:3000/runs/<id>/artifacts/out.json \
  -H "authorization: Bearer $LIGHT_RUN_TOKEN"

Run detached

Pass "detached": true to get a 202 with the run id immediately, then poll GET /runs/:id (or drive POST /runs/:id/stop|pause|resume|cancel). With a callbackUrl, the final RunState is POSTed to your URL; set callbackSecret to receive an X-Light-Run-Signature: sha256=<hmac> header.

On this page