Notify Shipyrd from the Docker container
Run the Shipyrd gem inside a container. Same hook commands as the Ruby gem, no Ruby toolchain on the host.
What it does
ghcr.io/shipyrd/shipyrd-gem is a thin image that runs the shipyrd CLI. It reads the same KAMAL_* environment variables as the Ruby gem and posts to Shipyrd’s API on your behalf. From the hook’s perspective, you’re shelling out to shipyrd pre-deploy / shipyrd post-deploy.
Setup
-
Make sure Docker is available wherever your deploys run from.
-
Define a wrapper function (in your shell profile, a hook helper, or inline in the hook script):
shipyrd() { docker run --rm \ --env-file <(env | grep -E '^(KAMAL_|SHIPYRD_)') \ ghcr.io/shipyrd/shipyrd-gem /shipyrd/bin/"$@" }The
--env-file <(env | grep ...)line forwards anyKAMAL_*andSHIPYRD_*variables into the container — that’s where the gem reads its inputs. -
Create Bash hooks that call the wrapper:
#!/usr/bin/env bash # .kamal/hooks/pre-deploy shipyrd pre-deploy#!/usr/bin/env bash # .kamal/hooks/post-deploy shipyrd post-deploychmod +x .kamal/hooks/pre-deploy .kamal/hooks/post-deploy -
Make sure
SHIPYRD_API_KEYis in the deploying shell’s environment (or in.kamal/secrets). -
Deploy.
kamal deploy
Verify it worked
Watch Kamal’s output for the hook lines. The first run will pull the container image (a few seconds); subsequent runs are instant. The deploy appears in your Shipyrd timeline once post-deploy runs.
Related
- Ruby gem — same gem, run directly when Ruby is available
- Plain HTTP — skip the gem entirely if you’d rather just
curl