Created
December 20, 2021 23:48
-
-
Save colinbut/275a2b1a4d2afbf518934871de4dd92b to your computer and use it in GitHub Desktop.
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/bash | |
yum update -y | |
# install docker | |
amazon-linux-extras install -y docker | |
service docker start | |
chkconfig docker on | |
usermod -a -G docker ec2-user | |
# install git | |
yum install git make -y | |
# install github runner application | |
sudo -u ec2-user mkdir /home/ec2-user/actions-runner | |
sudo -u ec2-user curl -o /home/ec2-user/actions-runner/actions-runner-linux-x64-2.278.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.278.0/actions-runner-linux-x64-2.278.0.tar.gz | |
sudo -u ec2-user tar xzf /home/ec2-user/actions-runner/actions-runner-linux-x64-2.278.0.tar.gz -C /home/ec2-user/actions-runner | |
sudo -u ec2-user EC2_INSTANCE_ID=`wget -q -O - http://169.254.169.254/latest/meta-data/instance-id` bash -c 'cd /home/ec2-user/actions-runner/;./config.sh --url ${github_repo_url} --pat ${github_repo_pat_token} --name "${runner_name}-$${EC2_INSTANCE_ID}" --work _work --labels ${labels} --runasservice' | |
# start the github runner as a service on startup | |
cd /home/ec2-user/actions-runner/;./svc.sh install | |
cd /home/ec2-user/actions-runner/;./svc.sh start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment