Commit 10693697 authored by Romulo Pereira Goncalves's avatar Romulo Pereira Goncalves
Browse files

Update docker build to not use sudo and use the host network.

parent ac3beb46
Pipeline #19425 passed with stages
in 20 minutes and 48 seconds
......@@ -18,24 +18,25 @@ cat >${cred_file} <<EOL
echo "#### Build runner docker image"
sudo docker rmi ${runner_tag}
sudo docker build -f ${context_dir}/${dockerfile} -m 20G -t ${runner_tag} ${context_dir}
docker rmi ${runner_tag}
docker build -f ${context_dir}/${dockerfile} -m 20G -t ${runner_tag} ${context_dir}
rm -f ${cred_file}
echo "#### Create gitlab-runner (daemon) container"
sudo docker stop ${gitlab_runner}
sudo docker rm ${gitlab_runner}
sudo docker run -d --name ${gitlab_runner} --restart always -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest
docker stop ${gitlab_runner}
docker rm ${gitlab_runner}
docker run -d --name ${gitlab_runner} --network host --restart always -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest
echo "#### Register container at gitlab"
read -p "Please enter gitlab token: " token
echo ""
read -p "Please enter gitlab runner name: " runner_name
echo "${runner_tag}"
sudo docker exec -it ${gitlab_runner} /bin/bash -c "export RUNNER_EXECUTOR=docker && gitlab-ci-multi-runner register -n \
--url '' \
docker exec -it ${gitlab_runner} /bin/bash -c "export RUNNER_EXECUTOR=docker && gitlab-ci-multi-runner register -n \
--url '' \
--registration-token '${token}' \
--run-untagged=true \
--docker-network-mode='host' \
--locked=true \
--tag-list gts2_client \
--docker-pull-policy='never' \
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment