GitLab CI - Docker Runner

安裝 GitLab Runner: https://docs.gitlab.com/runner/install/docker.html

docker run -d --name gitlab-runner --restart always \
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest

for Mac

docker run -d --name gitlab-runner --restart always \
-v /Users/Shared/gitlab-runner/config:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest

註冊 Runner: https://docs.gitlab.com/runner/register/index.html#docker

docker exec -it gitlab-runner gitlab-runner register -n \
--url https://gitlab.com/ \
--registration-token REGISTRATION_TOKEN \
--executor docker \
--description "My Docker Runner" \
--docker-image "docker:18.02-git" \
--docker-volumes /var/run/docker.sock:/var/run/docker.sock \
--docker-privileged