Skip to content

Instantly share code, notes, and snippets.

@schrockwell
Last active February 1, 2026 21:34
Show Gist options
  • Select an option

  • Save schrockwell/658ee396f6372f54bd9d28276281bd10 to your computer and use it in GitHub Desktop.

Select an option

Save schrockwell/658ee396f6372f54bd9d28276281bd10 to your computer and use it in GitHub Desktop.
Setup Sprite as a Docker builder
#! /bin/bash
#
# Installs sshd and dockerd services on a fresh Sprite instance.
#
# curl -fsSL "https://gist.githubusercontent.com/schrockwell/658ee396f6372f54bd9d28276281bd10/raw/install.sh" | bash
#
set -e
sudo apt update && sudo apt upgrade -y
sudo apt install curl openssh-server -y
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
sprite-env services create sshd --cmd /usr/sbin/sshd
sprite-env services create dockerd --cmd sudo --args /usr/bin/dockerd
echo '----------------------------------------------------------'
echo 'Next steps:'
echo
echo ' 1. Add your public key to /root/.ssh/authorized_keys'
echo ' 2. Locally, `sprite proxy 2223:22`'
echo ' 3. Locally, use root@localhost:2223 for Docker builds'
echo '----------------------------------------------------------'
builder:
arch: amd64
remote: ssh://root@localhost:2223
#! /bin/bash
if [ -f .kamal/hooks/.pre-build-proxy-pid ]; then
PROXY_PID=$(cat .kamal/hooks/.pre-build-proxy-pid)
kill $PROXY_PID
rm .kamal/hooks/.pre-build-proxy-pid
fi
#! /bin/bash
# kill any existing sprite processes
if [ -f .kamal/hooks/.sprite-pids ]; then
while read -r pid; do
if kill -0 "$pid" > /dev/null 2>&1; then
kill "$pid"
fi
done < .kamal/hooks/.sprite-pids
rm .kamal/hooks/.sprite-pids
fi
# start a console to keep the proxy running
nohup sprite console --sprite docker-build > /dev/null 2>&1 &
disown
echo $! > .kamal/hooks/.sprite-pids
# set up SSH proxy
nohup sprite proxy --sprite docker-build 2223:22 > /dev/null 2>&1 &
disown
echo $! >> .kamal/hooks/.sprite-pids
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment