Add runner that can run docker inside a container

This commit is contained in:
Wojciech Kozlowski 2018-01-25 14:22:44 +00:00
parent 0c2353f0df
commit 216b1d25a2
2 changed files with 41 additions and 5 deletions

View File

@ -143,10 +143,10 @@ services:
restart: always
# ---------------------------------------------------------------------------
# Gitlab runner for CI.
# Gitlab runners for CI.
# ---------------------------------------------------------------------------
runner:
runner-main:
container_name: runner-main
build: runner
image: gitlab.wojciechkozlowski.eu:8443/wojtek/loki/runner
@ -155,3 +155,17 @@ services:
- runner_main_home:/home/gitlab-runner
- /var/run/docker.sock:/var/run/docker.sock
restart: always
docker-dind:
container_name: docker-dind
image: docker:dind
privileged: true
restart: always
runner-docker:
container_name: runner-docker
build: runner
image: gitlab.wojciechkozlowski.eu:8443/wojtek/loki/runner
links:
- docker-dind:docker
restart: always

View File

@ -9,14 +9,36 @@ ENV DEBIAN_FRONTEND noninteractive
RUN apt update && apt upgrade -y
# Install gitlab-runner
RUN apt install -y gnupg && bash /tmp/script.deb.sh
RUN apt install -y gnupg2 && bash /tmp/script.deb.sh
RUN apt install -y gitlab-runner
# Install pre-requisites for running tests
RUN apt install -y build-essential \
python \
# Common
RUN apt install -y build-essential
# Python
RUN apt install -y python \
python-pip
# Docker
RUN apt install -y apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common
RUN curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | apt-key add -
RUN add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) \
stable"
RUN apt update && apt install -y docker-ce
ENV DOCKER_HOST "tcp://docker:2375"
# Preserve runner's data
VOLUME ["/etc/gitlab-runner", "/home/gitlab-runner"]