Commit b870c5a4 authored by Kevin Daudt's avatar Kevin Daudt 💬

add docker file to build the image

parent c4265cbb
FROM alpine:latest
ENV SSL_CERT_FILE /etc/ssl/cert.pem
RUN echo '@edge/testing' >> /etc/apk/repositories \
&& apk upgrade -U --no-cache \
&& apk add -U --no-cache \
gitlab-runner@edge/testing \
&& adduser -D -S -h /home/gitlab-runner gitlab-runner
COPY register-runner /usr/local/bin
VOLUME ["/etc/gitlab-runner", "/home/gitlab-runner"]
ENTRYPOINT ["/usr/bin/gitlab-runner"]
CMD ["run", "--user=gitlab-runner", "--working-directory=/home/gitlab-runner"]
......@@ -2,3 +2,37 @@
This will create a docker image for running a gitlab runner on Alpine Linux on
all the architectures that Alpine Linux supports.
## Starting the runner
To run the container, 1 required and 2 optional volumes need to be attached:
* docker socket (/var/run/docker.sock)
* conf dir (/etc/alpine-runner)
* home dir (/home/gitlab-runner)
For example:
docker run -d \
-v /srv/gitlab-runner/conf:/etc/gitlab-runner \
-v /srv/gitlab-runner/home:/home/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
You can execute `./run` to run this command
## Register the runner
There is a `./register-runner` command available in the container to register it.
To execute it, use the following command:
docker exec -e ARCH=<arch> -e GITLAB_REGISTER_TOKEN=<token> <container> register-runner
* `ARCH` is added as a tag on the runner
* `GITLAB_REGISTER_TOKEN` is a token you can find under `Settings > CI / CD > Runners`
of a specific project or under `Admin > Overview > Runners`.
version: 3
build: .
- /srv/gitlab-runner/conf:/etc/gitlab-runner
- /srv/gitlab-runner/home:/home/gitlab-runner
- /var/run/docker.sock:/var/run/docker.sock
gitlab-runner register \
--non-interactive \
--url "" \
--registration-token "$GITLAB_REGISTER_TOKEN" \
--executor "docker" \
--docker-image alpine:latest \
--description "docker-runner ($ARCH)" \
--tag-list "docker-alpine,$ARCH" \
--run-untagged="true" \
--locked="false" \
docker run -d \
-v /srv/gitlab-runner/conf:/etc/gitlab-runner \
-v /srv/gitlab-runner/home:/home/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
--name $name \
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment