[Unit]
Description=Ephemeral GitHub Actions Runner Container
Wants=network-online.target
After=network-online.target docker.service
Requires=docker.service

[Service]
Type=simple
ExecStartPre=-/usr/bin/docker rm --force %N
ExecStart=/usr/bin/docker run \
  --rm \
  --name=%N \
  --volume=/var/run/docker.sock:/var/run/docker.sock \
  --env-file={{ github_actions_runner_env_file }} \
  --env=RUNNER_NAME=%H \
  {{ github_actions_runner_docker_image }}
ExecStop=/usr/bin/docker stop %N
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
