build_testsuite_image.sh 1.15 KB
Newer Older
Daniel Scheffler's avatar
Daniel Scheffler committed
1
2
3
4
#!/usr/bin/env bash

context_dir="./context"
dockerfile="py_tools_ds_ci.docker"
5
tag="py_tools_ds_ci:0.15.2"
Daniel Scheffler's avatar
Daniel Scheffler committed
6
gitlab_runner="py_tools_ds_gitlab_CI_runner"
Daniel Scheffler's avatar
Daniel Scheffler committed
7
8

echo "#### Build runner docker image"
9
10
docker rmi ${tag}
docker build -f ${context_dir}/${dockerfile} -m 20G -t ${tag} ${context_dir}
Daniel Scheffler's avatar
Daniel Scheffler committed
11
12

echo "#### Create gitlab-runner (daemon) container with tag; ${tag}"
13
14
15
docker stop ${gitlab_runner}
docker rm ${gitlab_runner}
docker run -d --name ${gitlab_runner} --restart always \
Daniel Scheffler's avatar
Daniel Scheffler committed
16
17
18
19
20
21
22
-v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest

echo "#### Register container at gitlab, get token here https://gitext.gfz-potsdam.de/danschef/py_tools_ds/settings/ci_cd"
read -p "Please enter gitlab token: " token
echo ""
read -p "Please enter gitlab runner name: " runner_name
echo "New gitlab runner image will named  ${gitlab_runner}"
23
docker exec -it ${gitlab_runner} /bin/bash -c "export RUNNER_EXECUTOR=docker && gitlab-ci-multi-runner register -n \
Daniel Scheffler's avatar
Daniel Scheffler committed
24
25
26
27
28
29
30
31
  --url 'https://gitext.gfz-potsdam.de/ci' \
  --registration-token '${token}' \
  --run-untagged=true \
  --locked=true \
  --tag-list  py_tools_ds_ci_client \
  --description '${runner_name}' \
  --docker-image '${tag}' "
ls