Skip to content

Instantly share code, notes, and snippets.

@ircykk
Last active November 16, 2019 18:17
Show Gist options
  • Save ircykk/078e18a1c2289369027e70cb6410a479 to your computer and use it in GitHub Desktop.
Save ircykk/078e18a1c2289369027e70cb6410a479 to your computer and use it in GitHub Desktop.
Install docker, docker-compose and gitlab-runner for gitlab CI pipeline
#!/bin/sh
# Upgrade
apt-get update
apt-get -y upgrade
# Docker
apt-get remove docker docker-engine docker.io
apt-get --yes --force-yes install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update
apt-get install docker-ce composer
# Docker compose
curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
# Gitlab Runner
wget -O /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64
chmod +x /usr/local/bin/gitlab-runner
useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
gitlab-runner start
adduser -aG docker gitlab-runner
# Restart services
gitlab-runner restart
docker restart
# gitlab-runner register
# gitlab-runner ALL=(ALL) NOPASSWD: ALL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment