Commit ac94697f authored by Carlo Landmeter's avatar Carlo Landmeter

Merge branch 'initial-implementation' into 'master'

add docker file to build the image

See merge request alpine/infra/gitlab-runner!1
parents c4265cbb b870c5a4
FROM alpine:latest
ENV SSL_CERT_FILE /etc/ssl/cert.pem
RUN echo '@edge/testing http://dl-cdn.alpinelinux.org/alpine/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:
```sh
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 \
gitlab-runner
```
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:
```sh
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
services:
gitlab-runner:
build: .
volumes:
- /srv/gitlab-runner/conf:/etc/gitlab-runner
- /srv/gitlab-runner/home:/home/gitlab-runner
- /var/run/docker.sock:/var/run/docker.sock
#!/bin/sh
gitlab-runner register \
--non-interactive \
--url "https://gitlab.alpinelinux.org/" \
--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" \
--access-level="not_protected"
#!/bin/sh
name=${1-gitlab-runner}
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 \
gitlab-runner
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