Last active
March 18, 2019 15:59
-
-
Save editicalu/e4c13640da9f97c865654aca2261b5be to your computer and use it in GitHub Desktop.
Quickly setup a GitLab runner using Docker on Ubuntu
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 | |
# Should be run as root on a clean Ubuntu LTS installation | |
GITLAB_URL=https://gitlab.com | |
GITLAB_CI_TOKEN=insert-token-here | |
GITLAB_IMAGE=alpine | |
GITLAB_TAGS=ubuntu,docker | |
# If your hostname isn't unique, use this | |
#GITLAB_NAME=$RANDOM | |
GITLAB_NAME=`hostname` | |
# Install Docker | |
curl https://get.docker.com | sh | |
# Install GitLab Runner | |
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | bash | |
sudo apt-get -yqq install gitlab-runner | |
# Setup GitLab Runner | |
sudo gitlab-runner register \ | |
--non-interactive \ | |
--url $GITLAB_URL \ | |
--registration-token $GITLAB_CI_TOKEN \ | |
--executor "docker" \ | |
--docker-image $GITLAB_IMAGE \ | |
--description $GITLAB_NAME \ | |
--tag-list $GITLAB_TAGS \ | |
--run-untagged \ | |
--locked="false" \ | |
--docker-privileged | |
# Start it! | |
sudo gitlab-runner start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment