Skip to content

Instantly share code, notes, and snippets.

@Ottovsky Ottovsky/Dockerfile
Created May 11, 2020

Embed
What would you like to do?
gitlab-runner docker image for armv7
FROM golang:1.13.9-alpine3.11 as build
ARG GIT_LFS_VERSION
RUN mkdir -p src/github.com/git-lfs/git-lfs && \
wget -nv -O /tmp/git-lfs.tar.gz https://github.com/git-lfs/git-lfs/archive/v${GIT_LFS_VERSION}.tar.gz && \
tar xf /tmp/git-lfs.tar.gz -C src/github.com/git-lfs/git-lfs --strip-components 1 && \
GOARCH=arm GOOS=linux GOARM_VERSION=7 CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' -o bin/git-lfs github.com/git-lfs/git-lfs/
FROM arm32v7/alpine:3.10
RUN adduser -D -S -h /home/gitlab-runner gitlab-runner
RUN apk add --no-cache \
bash \
ca-certificates \
git \
openssl \
tzdata \
wget
ARG DOCKER_MACHINE_VERSION
ARG TINI_VERSION
ARG GITLAB_RUNNER_VERSION
COPY --from=build /go/bin/git-lfs /usr/bin/git-lfs
RUN wget -nv "https://gitlab-runner-downloads.s3.amazonaws.com/v${GITLAB_RUNNER_VERSION}/binaries/gitlab-runner-linux-arm" -O /usr/bin/gitlab-runner && \
chmod +x /usr/bin/gitlab-runner && \
chmod +x /usr/bin/git-lfs && \
ln -s /usr/bin/gitlab-runner /usr/bin/gitlab-ci-multi-runner && \
gitlab-runner --version && \
mkdir -p /etc/gitlab-runner/certs && \
chmod -R 700 /etc/gitlab-runner && \
wget -nv "https://github.com/docker/machine/releases/download/v${DOCKER_MACHINE_VERSION}/docker-machine-Linux-armhf" -O /usr/bin/docker-machine && \
chmod +x /usr/bin/docker-machine && \
docker-machine --version && \
wget -nv "https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static-armhf" -O /usr/bin/tini && \
chmod +x /usr/bin/tini && \
tini --version && \
git-lfs install --skip-repo && \
git-lfs version
RUN wget -nv "https://gitlab.com/gitlab-org/gitlab-runner/-/raw/v${GITLAB_RUNNER_VERSION}/dockerfiles/alpine/entrypoint" -O /entrypoint && \
chmod +x /entrypoint
STOPSIGNAL SIGQUIT
VOLUME ["/etc/gitlab-runner", "/home/gitlab-runner"]
ENTRYPOINT ["/usr/bin/tini","--", "/entrypoint"]
CMD ["run", "--user=gitlab-runner", "--working-directory=/home/gitlab-runner"]
@Ottovsky

This comment has been minimized.

Copy link
Owner Author

Ottovsky commented May 11, 2020

I couldn't find anywhere an armv7 working image of gitlab-runner, so here is one. This image can be used with raspberry pi 4. It can be installed in the k8s cluster by using standard helm installation:
helm upgrade --install --namespace gitlab-ci gitlab-runner -f values.yaml gitlab/gitlab-runner.
Where value.yaml:

gitlabUrl: https://gitlab.com/
runnerRegistrationToken: "registration-token"
image: ottovsky/gitlab-runner:armv7
concurrent: 10
checkInterval: 30
rbac:
  create: true
  clusterWideAccess: false
runners:
  image: ubuntu:18.04
  privileged: true
  builds:
    cpuRequests: 100m
    memoryRequests: 128Mi
  services:
    cpuRequests: 500m
    memoryRequests: 512Mi
  helpers: 
    cpuLimit: 2
    memoryLimit: 2048Mi
    cpuRequests: 100m
    memoryRequests: 128Mi
    image: gitlab/gitlab-runner-helper:arm-latest
    nodeSelector:
      kubernetes.io/arch: arm
nodeSelector: 
    kubernetes.io/arch: arm

ottovsky/gitlab-runner:armv7 is using gitlab-runner version 12.10.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.