Run this in Ubuntu:
bash -c "$(curl https://gist.githubusercontent.com/tyler-johnson/9edb36105861a3366812717f01e19d99/raw/gitlab-runner-setup.sh)"| #!/bin/bash | |
| # Update the OS | |
| sudo apt-get update | |
| sudo apt-get upgrade -y | |
| # Install Docker | |
| curl -sSL https://get.docker.com/ | sh | |
| # Install Docker Compose | |
| sudo apt-get install python-pip -y | |
| sudo pip install --upgrade pip | |
| sudo pip install docker-compose | |
| # Setup Compose | |
| echo " | |
| gitlab-runner: | |
| image: \"gitlab/gitlab-runner:latest\" | |
| restart: always | |
| volumes: | |
| - /var/run/docker.sock:/var/run/docker.sock | |
| - /etc/gitlab-runner:/etc/gitlab-runner | |
| " > docker-compose.yml | |
| # Start the Runner | |
| docker-compose up -d | |
| # Register and Configure the Runner | |
| docker exec -i $(docker-compose ps -q gitlab-runner) gitlab-runner register | |
| vi /etc/gitlab-runner/config.toml | |
| # Restart the Runner | |
| docker-compose restart gitlab-runner |