Split runner into two

This commit is contained in:
Wojciech Kozlowski 2018-01-25 21:21:17 +00:00
parent 6d637e105b
commit 209a735039
5 changed files with 102 additions and 44 deletions

View File

@ -97,22 +97,80 @@ certbot-pull:
certbot: certbot-clean certbot-build certbot-push
# -----------------------------------------------------------------------------
# runner
# runners
# -----------------------------------------------------------------------------
runner-clean:
docker rmi $(DOCKER_REGISTRY)/runner || /bin/true
# base ------------------------------------------------------------------------
runner-build:
runner-base-clean:
docker rmi $(DOCKER_REGISTRY)/runner-base || /bin/true
runner-base-build:
docker build -f runner/Dockerfile \
-t $(DOCKER_REGISTRY)/runner-base \
./runner
runner-base-push:
docker push $(DOCKER_REGISTRY)/runner-base
runner-base-pull:
docker pull $(DOCKER_REGISTRY)/runner-base
runner-base: runner-base-clean runner-base-build runner-base-push
# main ------------------------------------------------------------------------
runner-main-clean:
docker rmi $(DOCKER_REGISTRY)/runner-main || /bin/true
runner-main-build: runner-base-build
docker-compose build runner-main
runner-push:
runner-main-push:
docker-compose push runner-main
runner-pull:
runner-main-pull:
docker-compose pull runner-main
runner: runner-clean runner-build runner-push
runner-main: runner-main-clean runner-main-build runner-main-push
# docker ----------------------------------------------------------------------
runner-docker-clean:
docker rmi $(DOCKER_REGISTRY)/runner-docker || /bin/true
runner-docker-build: runner-base-build
docker-compose build runner-docker
runner-docker-push:
docker-compose push runner-docker
runner-docker-pull:
docker-compose pull runner-docker
runner-docker: runner-docker-clean runner-docker-build runner-docker-push
# collect ---------------------------------------------------------------------
runners-clean: \
runner-base-clean \
runner-main-clean \
runner-docker-clean
runners-build: \
runner-base-build \
runner-main-build \
runner-docker-build
runners-push: \
runner-main-push \
runner-docker-push
runners-pull: \
runner-main-pull \
runner-docker-pull
runners: runners-clean runners-build runners-push
# -----------------------------------------------------------------------------
# Collect targets.
@ -121,9 +179,16 @@ runner: runner-clean runner-build runner-push
clean-all:
docker rmi $(shell docker images -q) || /bin/true
clean-builds: wiki-clean nextcloud-cron-clean proxy-clean certbot-clean runner-clean
clean-builds: \
wiki-clean \
nextcloud-cron-clean \
proxy-clean \
certbot-clean \
runner-base-clean \
runner-main-clean \
runner-docker-clean
build-all:
build-all: runner-base-build
docker-compose build
push-all:
@ -132,8 +197,6 @@ push-all:
pull-all:
docker-compose pull
pull-builds: wiki-pull nextcloud-cron-pull proxy-pull certbot-pull runner-pull
# -----------------------------------------------------------------------------
# Clean - build - push
# -----------------------------------------------------------------------------

View File

@ -148,8 +148,8 @@ services:
runner-main:
container_name: runner-main
build: runner
image: gitlab.wojciechkozlowski.eu:8443/wojtek/loki/runner
build: runner/main
image: gitlab.wojciechkozlowski.eu:8443/wojtek/loki/runner-main
volumes:
- runner_main_etc:/etc/gitlab-runner
- runner_main_home:/home/gitlab-runner
@ -164,8 +164,8 @@ services:
runner-docker:
container_name: runner-docker
build: runner
image: gitlab.wojciechkozlowski.eu:8443/wojtek/loki/runner
build: runner/docker
image: gitlab.wojciechkozlowski.eu:8443/wojtek/loki/runner-docker
links:
- docker-dind:docker
restart: always

View File

@ -9,35 +9,7 @@ ENV DEBIAN_FRONTEND noninteractive
RUN apt update && apt upgrade -y
# Install gitlab-runner
RUN apt install -y gnupg2 && bash /tmp/script.deb.sh
RUN apt install -y gitlab-runner
# Install pre-requisites for running tests
# 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"
RUN apt install -y gnupg2 && bash /tmp/script.deb.sh && apt install -y gitlab-runner
# Preserve runner's data
VOLUME ["/etc/gitlab-runner", "/home/gitlab-runner"]

18
runner/docker/Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM gitlab.wojciechkozlowski.eu:8443/wojtek/loki/runner-base
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 docker-compose
ENV DOCKER_HOST "tcp://docker:2375"

5
runner/main/Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM gitlab.wojciechkozlowski.eu:8443/wojtek/loki/runner-base
RUN apt install -y build-essential \
python \
python-pip