├── .gitignore ├── .gitlab-ci.yml ├── LICENSE ├── Makefile ├── Readme.md ├── VERSION ├── ci ├── aws │ ├── arm │ │ └── main.tf │ └── arm64 │ │ └── main.tf ├── build-alpine ├── build-ubuntu ├── multi-arch ├── release └── version └── dockerfiles ├── alpine ├── Dockerfile └── entrypoint └── ubuntu ├── Dockerfile └── entrypoint /.gitignore: -------------------------------------------------------------------------------- 1 | binaries 2 | */binaries 3 | .terraform 4 | *.tfstate* -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - register 3 | - images 4 | - unregister 5 | - multi-arch 6 | 7 | .image: 8 | image: docker:stable 9 | stage: images 10 | services: 11 | - docker:stable-dind 12 | variables: 13 | DOCKER_DRIVER: overlay2 14 | before_script: 15 | - export RUNNER_ARCH=$(echo $CI_JOB_NAME|sed 's,.*:,,g') 16 | - export RUN_AS_PLATFORM="${RUNNER_ARCH}" 17 | - apk add --no-cache make bash 18 | script: 19 | - make all 20 | tags: 21 | - docker 22 | - arm64 23 | 24 | .runner: 25 | image: 26 | name: hashicorp/terraform:0.14.7 27 | entrypoint: [""] 28 | before_script: 29 | - export RUNNER_ARCH=$(echo $CI_JOB_NAME|sed 's,.*:,,g') 30 | - export TASK=$(echo $CI_JOB_NAME|sed 's,:.*$,,g') 31 | - cd ci/aws/$RUNNER_ARCH 32 | - terraform init 33 | script: 34 | - terraform $TASK -auto-approve 35 | 36 | apply:arm: 37 | extends: .runner 38 | stage: register 39 | 40 | test:arm: 41 | extends: .image 42 | script: 43 | - make build 44 | except: 45 | - master 46 | needs: 47 | - apply:arm 48 | 49 | img:arm: 50 | extends: .image 51 | only: 52 | - master 53 | environment: 54 | name: arm/docker_images 55 | url: https://hub.docker.com/r/klud/gitlab-runner/tags/ 56 | needs: 57 | - apply:arm 58 | 59 | destroy:arm: 60 | extends: .runner 61 | stage: unregister 62 | when: always 63 | 64 | apply:arm64: 65 | extends: .runner 66 | stage: register 67 | 68 | test:arm64: 69 | extends: .image 70 | script: 71 | - make build 72 | except: 73 | - master 74 | needs: 75 | - apply:arm64 76 | 77 | img:arm64: 78 | extends: .image 79 | only: 80 | - master 81 | environment: 82 | name: arm/docker_images 83 | url: https://hub.docker.com/r/klud/gitlab-runner/tags/ 84 | needs: 85 | - apply:arm64 86 | 87 | destroy:arm64: 88 | extends: .runner 89 | stage: unregister 90 | when: always 91 | 92 | arch-tag: 93 | stage: multi-arch 94 | image: ulm0/manifest-tool:1.0.0 95 | script: 96 | - make multi-arch 97 | only: 98 | - master 99 | needs: 100 | - img:arm 101 | - img:arm64 102 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-2020 Pierre Ugaz (ulm0) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | export MAINTAINER:=klud 2 | export NAME:=gitlab-runner 3 | export IMAGE:=$(MAINTAINER)/$(NAME) 4 | export VERSION:=$(shell ./ci/version) 5 | export ARCHS:="armhf aarch64" 6 | 7 | all: version build push 8 | all-arm64: version build-alpine push 9 | 10 | help: 11 | # General commands: 12 | # make all => build push 13 | # make version - show information about the current version 14 | # 15 | # Commands 16 | # make build - build the Runner image 17 | # make push - push the image to Docker Hub 18 | 19 | version: FORCE 20 | @echo "---" 21 | @echo Version: $(VERSION) 22 | @echo Image: $(IMAGE):$(VERSION) 23 | @echo Platorms: $(ARCHS) 24 | @echo "" 25 | @echo Brought to you by ulm0 26 | @echo "---" 27 | 28 | build: build-alpine build-ubuntu 29 | 30 | build-alpine: 31 | @./ci/build-alpine 32 | 33 | build-ubuntu: 34 | @./ci/build-ubuntu 35 | 36 | push: 37 | @./ci/release 38 | 39 | multi-arch: 40 | @./ci/multi-arch 41 | 42 | FORCE: 43 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # GitLab Runner for ARM 2 | 3 | [![pipeline status](https://gitlab.com/ulm0/gitlab-runner/badges/master/pipeline.svg)](https://gitlab.com/ulm0/gitlab-runner/-/commits/master) [![Docker Pulls](https://img.shields.io/docker/pulls/klud/gitlab-runner.svg)](https://hub.docker.com/r/klud/gitlab-runner/) [![Docker Pulls](https://img.shields.io/docker/stars/klud/gitlab-runner.svg)](https://hub.docker.com/r/klud/gitlab-runner/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) 4 | 5 | ## Tags 6 | 7 | [![](https://images.microbadger.com/badges/version/klud/gitlab-runner:alpine.svg)](https://microbadger.com/images/klud/gitlab-runner:alpine "Get your own version badge on microbadger.com") 8 | 9 | [![](https://images.microbadger.com/badges/version/klud/gitlab-runner:ubuntu.svg)](https://microbadger.com/images/klud/gitlab-runner:ubuntu "Get your own version badge on microbadger.com") 10 | 11 | **Notes:** 12 | - Alpine is the default image, when running `docker pull klud/gitlab-runner` this one is going to be downloaded depending on the runner arch, at the moment only arm is supported. 13 | 14 | 15 | ## About the image 16 | 17 | These image are built for ARM devices, based on the [official repo](https://gitlab.com/gitlab-org/gitlab-runner) of the GitLab Runner, both Alpine and Ubuntu flavors are available. 18 | 19 | ## Overview 20 | 21 | ### Runner container setup 22 | 23 | You need to mount a config volume into our gitlab-runner container to be used for configs and other resources: 24 | 25 | ```sh 26 | docker run -d --name arm-runner \ 27 | -v $(pwd)/.runner:/etc/gitlab-runner \ 28 | --restart=always \ 29 | klud/gitlab-runner 30 | ``` 31 | 32 | Or you can use a config container to mount your custom data volume: 33 | 34 | ```sh 35 | docker run -d --name runner-config \ 36 | -v /etc/gitlab-runner \ 37 | armhf/busybox \ 38 | /bin/true 39 | 40 | docker run -d --name arm-runner --restart=always \ 41 | --volumes-from runner-config \ 42 | klud/gitlab-runner 43 | ``` 44 | 45 | If you plan on using the Docker executor, it is necessary to mount the Docker socket this way: 46 | 47 | ```sh 48 | docker run -d --name arm-runner --restart=always \ 49 | -v /var/run/docker.sock:/var/run/docker.sock \ 50 | -v $(pwd)/.runner:/etc/gitlab-runner \ 51 | klud/gitlab-runner 52 | ``` 53 | 54 | You can achieve this by using a `docker-compose.yml` file as well: 55 | 56 | ```yaml 57 | version: "2" 58 | runner: 59 | image: klud/gitlab-runner 60 | container_name: arm-runner 61 | restart: always 62 | volumes: 63 | - $(pwd)/.runner:/etc/gitlab-runner 64 | - /var/run/docker.sock:/var/run/docker.sock 65 | ``` 66 | 67 | ### Register runner 68 | 69 | Once the container is up and running, it is time to register the runner on the GitLab server 70 | 71 | You can either do this: 72 | 73 | ```sh 74 | docker exec -it arm-runner gitlab-runner register 75 | 76 | Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com ) 77 | https://gitlab.domain.tld 78 | Please enter the gitlab-ci token for this runner 79 | XXXXXXXXXXXXXXXXXXXX 80 | Please enter the gitlab-ci description for this runner 81 | ARM Runner by ulm0 82 | INFO[0034] fcf5c619 Registering runner... succeeded 83 | Please enter the executor: shell, docker, docker-ssh, ssh? 84 | docker 85 | Please enter the Docker image (eg. ruby:2.1): 86 | docker:17.12 87 | INFO[0037] Runner registered successfully. Feel free to start it, but if it's 88 | running already the config should be automatically reloaded! 89 | ``` 90 | 91 | Or this: 92 | 93 | ```sh 94 | docker exec -it arm-runner \ 95 | gitlab-runner register -n \ 96 | --url https://gitlab.domain.tld \ 97 | --registration-token XXXXXXXXXXXXXXXXXXXX \ 98 | --executor docker \ 99 | --description "ARM Runner by ulm0" \ 100 | --docker-image "docker:17.12" \ 101 | --tag-list "docker,arm" \ 102 | --docker-privileged 103 | ``` 104 | 105 | ## Troubleshooting 106 | 107 | If you're using `docker in docker` in the runner, you may expirience some problems when talking to the docker socket 108 | 109 | ```sh 110 | Cannot connect to the Docker daemon. Is the docker daemon running on this host? 111 | ``` 112 | 113 | In order to address this issue you need to look within the config folder you mounted in the runner container, there will be a config file inside, you need to add some lines and then restart the runner with `docker restart arm-runner`. 114 | 115 | ```toml 116 | concurrent = 1 117 | check_interval = 0 118 | 119 | [[runners]] 120 | name = "ARM Runner by ulm0" 121 | url = "https://gitlab.domain.tld" 122 | token = "XXXXXXXXXXXXXXXXXXXX" 123 | executor = "docker" 124 | [runners.docker] 125 | tls_verify = false 126 | image = "docker:17.12" 127 | ### IF YOU USED THE FIRST METHOD YOU NEED TO SET 128 | ### THE RUNNER IN PRIVILEGED MODE TO BE ABLE TO SPAWN JOBS 129 | privileged = true 130 | disable_cache = false 131 | ### YOU MAY NEED TO ADD THE CACHE DIR 132 | cache_dir = "cache" 133 | ### AND THE DOCKER SOCKET TO BE ABLE TO SPAWN JOBS AS WELL 134 | volumes = ["/var/run/docker.sock:/var/run/docker.sock","/cache"] 135 | [runners.cache] 136 | ``` 137 | 138 | [![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](https://forthebadge.com) [![forthebadge](https://forthebadge.com/images/badges/for-you.svg)](https://forthebadge.com) -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 13.10.0 2 | -------------------------------------------------------------------------------- /ci/aws/arm/main.tf: -------------------------------------------------------------------------------- 1 | terraform { 2 | backend "s3" { 3 | bucket = "ulm0-tf-backend" 4 | key = "runner/gitlab-ci-arm" 5 | encrypt = true 6 | region = "us-east-1" 7 | } 8 | } 9 | 10 | provider "aws" { 11 | region = "us-east-1" 12 | } 13 | 14 | module "arm" { 15 | source = "git::https://gitlab.com/innersea/tf-modules/gitlab-runner.git" 16 | name = "ARM runner builder" 17 | gitlab_token = var.gitlab_token 18 | run_as_platform = "arm" 19 | } 20 | 21 | variable "gitlab_token" {} 22 | -------------------------------------------------------------------------------- /ci/aws/arm64/main.tf: -------------------------------------------------------------------------------- 1 | terraform { 2 | backend "s3" { 3 | bucket = "ulm0-tf-backend" 4 | key = "runner/gitlab-ci-arm64" 5 | encrypt = true 6 | region = "us-east-1" 7 | } 8 | } 9 | 10 | provider "aws" { 11 | region = "us-east-1" 12 | } 13 | 14 | module "arm64" { 15 | source = "git::https://gitlab.com/innersea/tf-modules/gitlab-runner.git" 16 | name = "ARM64 runner builder" 17 | gitlab_token = var.gitlab_token 18 | run_as_platform = "arm64" 19 | } 20 | 21 | variable "gitlab_token" {} 22 | -------------------------------------------------------------------------------- /ci/build-alpine: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eo pipefail 4 | 5 | apkArch="$(apk --print-arch)" 6 | case "$apkArch" in 7 | armhf) runnerArch='arm' ;; 8 | armv7) runnerArch='arm' ;; 9 | aarch64) runnerArch='arm64' ;; 10 | *) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;; 11 | esac 12 | 13 | export RUN_AS_PLATFORM=${RUN_AS_PLATFORM:-$runnerArch} 14 | 15 | _docker(){ 16 | docker "${@}" 17 | } 18 | 19 | build() { 20 | echo -e "\033[1mBuilding image: \033[32m${2}\033[0m" 21 | _docker build --platform="${RUN_AS_PLATFORM}" --build-arg "${1}" -t "${2}" -f "${3}" "${4}" 22 | } 23 | 24 | build "RUNNER_VERSION=${VERSION}" "${IMAGE}:${VERSION}-${RUN_AS_PLATFORM}" dockerfiles/alpine/Dockerfile dockerfiles/alpine 25 | -------------------------------------------------------------------------------- /ci/build-ubuntu: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eo pipefail 4 | 5 | hostArch=$(uname -m) 6 | case "$hostArch" in 7 | armhf) runnerArch='arm' ;; 8 | armv7) runnerArch='arm' ;; 9 | aarch64) runnerArch='arm64' ;; 10 | *) echo >&2 "error: unsupported architecture ($hostArch)"; exit 1 ;; 11 | esac 12 | 13 | export RUN_AS_PLATFORM=${RUN_AS_PLATFORM:-$runnerArch} 14 | 15 | _docker(){ 16 | docker "${@}" 17 | } 18 | 19 | build() { 20 | echo -e "\033[1mBuilding image: \033[32m${2}\033[0m" 21 | _docker build --platform="${RUN_AS_PLATFORM}" --build-arg "${1}" -t "${2}" -f "${3}" "${4}" 22 | } 23 | 24 | build "RUNNER_VERSION=${VERSION}" "${IMAGE}:${VERSION}-ubuntu" dockerfiles/ubuntu/Dockerfile dockerfiles/ubuntu 25 | -------------------------------------------------------------------------------- /ci/multi-arch: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eo pipefail 4 | 5 | export PLATFORMS="linux/arm,linux/arm64" 6 | 7 | manifest-tool --username $DOCKER_HUB_USER --password $DOCKER_HUB_PASSWORD push from-args --ignore-missing --platforms $PLATFORMS --template $IMAGE:$VERSION-ARCH --target $IMAGE:$VERSION 8 | manifest-tool --username $DOCKER_HUB_USER --password $DOCKER_HUB_PASSWORD push from-args --ignore-missing --platforms $PLATFORMS --template $IMAGE:$VERSION-alpine-ARCH --target $IMAGE:$VERSION-alpine 9 | manifest-tool --username $DOCKER_HUB_USER --password $DOCKER_HUB_PASSWORD push from-args --ignore-missing --platforms $PLATFORMS --template $IMAGE:alpine-ARCH --target $IMAGE:alpine 10 | manifest-tool --username $DOCKER_HUB_USER --password $DOCKER_HUB_PASSWORD push from-args --ignore-missing --platforms $PLATFORMS --template $IMAGE:latest-ARCH --target $IMAGE:latest 11 | -------------------------------------------------------------------------------- /ci/release: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eo pipefail 4 | 5 | apkArch="$(apk --print-arch)" 6 | case "$apkArch" in 7 | armhf) runnerArch='arm' ;; 8 | armv7) runnerArch='arm' ;; 9 | aarch64) runnerArch='arm64' ;; 10 | *) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;; 11 | esac 12 | 13 | export RUN_AS_PLATFORM=${RUN_AS_PLATFORM:-$runnerArch} 14 | 15 | _docker(){ 16 | docker "${@}" 17 | } 18 | 19 | tag() { 20 | echo -e "\033[1mTagging image: \033[33m${2}\033[0m" 21 | _docker tag "${1}" "${2}" 22 | } 23 | 24 | push() { 25 | echo -e "\033[1mPushing image: \033[35m${1}\033[0m" 26 | _docker push "${1}" 27 | } 28 | 29 | login() { 30 | echo "${2}" | _docker login --username "${1}" --password-stdin "${3}" 31 | } 32 | 33 | logout() { 34 | _docker logout "${1}" 35 | } 36 | 37 | tag "${IMAGE}:${VERSION}-${RUN_AS_PLATFORM}" "${IMAGE}:${VERSION}-alpine-${RUN_AS_PLATFORM}" 38 | tag "${IMAGE}:${VERSION}-${RUN_AS_PLATFORM}" "${IMAGE}:alpine-${RUN_AS_PLATFORM}" 39 | tag "${IMAGE}:${VERSION}-${RUN_AS_PLATFORM}" "${IMAGE}:latest-${RUN_AS_PLATFORM}" 40 | if [[ "${RUN_AS_PLATFORM}" == "arm" ]]; then 41 | tag "${IMAGE}:${VERSION}-ubuntu" "${IMAGE}:ubuntu" 42 | fi 43 | 44 | if [[ -n "${CI_REGISTRY}" ]] && [[ -n "${CI_REGISTRY_IMAGE}" ]]; then 45 | tag "${IMAGE}:${VERSION}-${RUN_AS_PLATFORM}" "${CI_REGISTRY_IMAGE}:${VERSION}-${RUN_AS_PLATFORM}" 46 | tag "${IMAGE}:${VERSION}-${RUN_AS_PLATFORM}" "${CI_REGISTRY_IMAGE}:${VERSION}-alpine-${RUN_AS_PLATFORM}" 47 | tag "${IMAGE}:${VERSION}-${RUN_AS_PLATFORM}" "${CI_REGISTRY_IMAGE}:alpine-${RUN_AS_PLATFORM}" 48 | tag "${IMAGE}:${VERSION}-${RUN_AS_PLATFORM}" "${CI_REGISTRY_IMAGE}:latest-${RUN_AS_PLATFORM}" 49 | if [[ "${RUN_AS_PLATFORM}" == "arm" ]]; then 50 | tag "${IMAGE}:${VERSION}-ubuntu" "${CI_REGISTRY_IMAGE}:${VERSION}-ubuntu" 51 | tag "${IMAGE}:${VERSION}-ubuntu" "${CI_REGISTRY_IMAGE}:ubuntu" 52 | fi 53 | 54 | if [[ -n "${CI_REGISTRY_USER}" ]] && [[ -n "${CI_REGISTRY_PASSWORD}" ]]; then 55 | login "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}" 56 | 57 | push "${CI_REGISTRY_IMAGE}:${VERSION}-${RUN_AS_PLATFORM}" 58 | push "${CI_REGISTRY_IMAGE}:${VERSION}-alpine-${RUN_AS_PLATFORM}" 59 | push "${CI_REGISTRY_IMAGE}:alpine-${RUN_AS_PLATFORM}" 60 | push "${CI_REGISTRY_IMAGE}:latest-${RUN_AS_PLATFORM}" 61 | if [[ "${RUN_AS_PLATFORM}" == "arm" ]]; then 62 | push "${CI_REGISTRY_IMAGE}:${VERSION}-ubuntu" 63 | push "${CI_REGISTRY_IMAGE}:ubuntu" 64 | fi 65 | 66 | logout "${CI_REGISTRY}" 67 | fi 68 | fi 69 | 70 | if [[ -n "${DOCKER_HUB_USER}" ]] && [[ -n "${DOCKER_HUB_PASSWORD}" ]]; then 71 | login "${DOCKER_HUB_USER}" "${DOCKER_HUB_PASSWORD}" 72 | 73 | push "${IMAGE}:${VERSION}-${RUN_AS_PLATFORM}" 74 | push "${IMAGE}:${VERSION}-alpine-${RUN_AS_PLATFORM}" 75 | push "${IMAGE}:alpine-${RUN_AS_PLATFORM}" 76 | push "${IMAGE}:latest-${RUN_AS_PLATFORM}" 77 | if [[ "${RUN_AS_PLATFORM}" == "arm" ]]; then 78 | push "${IMAGE}:${VERSION}-ubuntu" 79 | push "${IMAGE}:ubuntu" 80 | fi 81 | 82 | logout 83 | fi 84 | -------------------------------------------------------------------------------- /ci/version: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eo pipefail 4 | 5 | version=$(cat VERSION || echo dev | sed -e 's/^v//g') 6 | echo "${version}" 7 | -------------------------------------------------------------------------------- /dockerfiles/alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.10 2 | LABEL maintainer "Pierre Ugaz " 3 | ARG RUNNER_VERSION 4 | ARG DOCKER_MACHINE_VERSION=0.16.2 5 | COPY entrypoint / 6 | RUN set -eux; \ 7 | \ 8 | apkArch="$(apk --print-arch)"; \ 9 | case "$apkArch" in \ 10 | # arm32v6 11 | armhf) runnerArch='arm' ;; \ 12 | # arm32v7 13 | armv7) runnerArch='arm' ;; \ 14 | # arm64v8 15 | aarch64) runnerArch='arm64' ;; \ 16 | *) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;;\ 17 | esac; \ 18 | \ 19 | case "$apkArch" in \ 20 | # arm32v6 21 | armhf) machineArch='armhf' ;; \ 22 | # arm32v7 23 | armv7) machineArch='armhf' ;; \ 24 | # arm64v8 25 | aarch64) machineArch='aarch64' ;; \ 26 | *) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;;\ 27 | esac; \ 28 | \ 29 | adduser -D -S -h /home/gitlab-runner gitlab-runner && \ 30 | apk add --no-cache \ 31 | dumb-init=1.2.2-r1 \ 32 | bash \ 33 | ca-certificates \ 34 | git \ 35 | openssl \ 36 | tzdata \ 37 | git-lfs \ 38 | wget && \ 39 | wget -q "https://gitlab-runner-downloads.s3.amazonaws.com/v${RUNNER_VERSION}/binaries/gitlab-runner-linux-${runnerArch}" -O /usr/bin/gitlab-runner && \ 40 | chmod +x /usr/bin/gitlab-runner && \ 41 | ln -s /usr/bin/gitlab-runner /usr/bin/gitlab-ci-multi-runner && \ 42 | gitlab-runner --version && \ 43 | mkdir -p /etc/gitlab-runner/certs && \ 44 | chmod -R 700 /etc/gitlab-runner && \ 45 | wget -q "https://github.com/docker/machine/releases/download/v${DOCKER_MACHINE_VERSION}/docker-machine-Linux-${machineArch}" -O /usr/bin/docker-machine && \ 46 | chmod +x /usr/bin/docker-machine && \ 47 | chmod +x /entrypoint && \ 48 | docker-machine --version && \ 49 | dumb-init --version && \ 50 | git-lfs install --skip-repo && \ 51 | git-lfs version 52 | STOPSIGNAL SIGQUIT 53 | VOLUME ["/etc/gitlab-runner", "/home/gitlab-runner"] 54 | ENTRYPOINT ["/usr/bin/dumb-init", "/entrypoint"] 55 | CMD ["run", "--user=gitlab-runner", "--working-directory=/home/gitlab-runner"] 56 | -------------------------------------------------------------------------------- /dockerfiles/alpine/entrypoint: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # gitlab-runner data directory 4 | DATA_DIR="/etc/gitlab-runner" 5 | CONFIG_FILE=${CONFIG_FILE:-$DATA_DIR/config.toml} 6 | # custom certificate authority path 7 | CA_CERTIFICATES_PATH=${CA_CERTIFICATES_PATH:-$DATA_DIR/certs/ca.crt} 8 | LOCAL_CA_PATH="/usr/local/share/ca-certificates/ca.crt" 9 | 10 | update_ca() { 11 | echo "Updating CA certificates..." 12 | cp "${CA_CERTIFICATES_PATH}" "${LOCAL_CA_PATH}" 13 | update-ca-certificates --fresh >/dev/null 14 | } 15 | 16 | if [ -f "${CA_CERTIFICATES_PATH}" ]; then 17 | # update the ca if the custom ca is different than the current 18 | cmp -s "${CA_CERTIFICATES_PATH}" "${LOCAL_CA_PATH}" || update_ca 19 | fi 20 | 21 | # launch gitlab-runner passing all arguments 22 | exec gitlab-runner "$@" 23 | -------------------------------------------------------------------------------- /dockerfiles/ubuntu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | LABEL maintainer "Pierre Ugaz " 3 | ARG RUNNER_VERSION 4 | ARG DOCKER_MACHINE_VERSION=0.16.2 5 | ENV DEBIAN_FRONTEND=noninteractive 6 | COPY entrypoint / 7 | RUN apt-get update -y && \ 8 | apt-get upgrade -y && \ 9 | apt-get install -y ca-certificates wget apt-transport-https curl git vim nano tzdata git-lfs dumb-init && \ 10 | wget -q "https://packages.gitlab.com/runner/gitlab-runner/packages/ubuntu/bionic/gitlab-runner_${RUNNER_VERSION}_armhf.deb/download" -O /tmp/gitlab-runner_armhf.deb && \ 11 | dpkg -i /tmp/gitlab-runner_armhf.deb; \ 12 | apt-get update && \ 13 | apt-get -f install -y && \ 14 | apt-get clean && \ 15 | rm -rf /var/lib/apt/lists/* && \ 16 | rm -f /tmp/gitlab-runner_armhf.deb && \ 17 | gitlab-runner --version && \ 18 | mkdir -p /etc/gitlab-runner/certs && \ 19 | chmod -R 700 /etc/gitlab-runner && \ 20 | wget -q "https://github.com/docker/machine/releases/download/v${DOCKER_MACHINE_VERSION}/docker-machine-Linux-armhf" -O /usr/bin/docker-machine && \ 21 | chmod +x /usr/bin/docker-machine && \ 22 | chmod +x /entrypoint && \ 23 | docker-machine --version && \ 24 | chmod +x /usr/bin/dumb-init && \ 25 | dumb-init --version && \ 26 | git-lfs install --skip-repo && \ 27 | git-lfs version 28 | STOPSIGNAL SIGQUIT 29 | VOLUME ["/etc/gitlab-runner", "/home/gitlab-runner"] 30 | ENTRYPOINT ["/usr/bin/dumb-init", "/entrypoint"] 31 | CMD ["run", "--user=gitlab-runner", "--working-directory=/home/gitlab-runner"] 32 | -------------------------------------------------------------------------------- /dockerfiles/ubuntu/entrypoint: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # gitlab-runner data directory 4 | DATA_DIR="/etc/gitlab-runner" 5 | CONFIG_FILE=${CONFIG_FILE:-$DATA_DIR/config.toml} 6 | # custom certificate authority path 7 | CA_CERTIFICATES_PATH=${CA_CERTIFICATES_PATH:-$DATA_DIR/certs/ca.crt} 8 | LOCAL_CA_PATH="/usr/local/share/ca-certificates/ca.crt" 9 | 10 | update_ca() { 11 | echo "Updating CA certificates..." 12 | cp "${CA_CERTIFICATES_PATH}" "${LOCAL_CA_PATH}" 13 | update-ca-certificates --fresh >/dev/null 14 | } 15 | 16 | if [ -f "${CA_CERTIFICATES_PATH}" ]; then 17 | # update the ca if the custom ca is different than the current 18 | cmp --silent "${CA_CERTIFICATES_PATH}" "${LOCAL_CA_PATH}" || update_ca 19 | fi 20 | 21 | # launch gitlab-runner passing all arguments 22 | exec gitlab-runner "$@" 23 | --------------------------------------------------------------------------------