Created
August 25, 2022 07:09
-
-
Save wojas/736af29bcfb607bd6abebfb0faaf1fc2 to your computer and use it in GitHub Desktop.
Run the Gitlab runner locally in Docker (tested on macOS)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Based on https://stackoverflow.com/a/65920577/297793 | |
# Manually start this first: | |
## docker run -d \ | |
## --name gitlab-runner \ | |
## --restart always \ | |
## -v "$HOME:$HOME" \ | |
## -v /var/run/docker.sock:/var/run/docker.sock \ | |
## gitlab/gitlab-runner:latest | |
job="$1" | |
if [ -z "$job" ]; then | |
echo "USAGE: $0 <job-name>" | |
exit 2 | |
fi | |
echo "* Checking if gitlab-runner is running.." | |
if ! docker inspect gitlab-runner > /dev/null ; then | |
echo | |
echo "ERROR: gitlab-runner NOT RUNNING, run this first:" | |
echo | |
grep '^##' "$0" | sed 's/^## //' | |
exit 10 | |
fi | |
set -ex | |
docker exec -it -w "$PWD" gitlab-runner gitlab-runner exec docker "$job" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment