docker-github-runner
docker-github-runner copied to clipboard
Alpine version
An alpine version would be beneficial
won't work because the github runner is not musl compatible. I tried on a barebone alpine installation
I did try and here is the diff anyone can re-use
CLI output
williamdes@williamdes:/mnt/Dev/@williamdes/docker-github-runner$ make build
docker build -t "tcardonne/github-runner" docker
Sending build context to Docker daemon 10.24kB
Step 1/25 : ARG FROM=mcr.microsoft.com/dotnet/runtime-deps:3.1-alpine
Step 2/25 : FROM ${FROM}
---> d5d46b0ce104
Step 3/25 : ARG GH_RUNNER_VERSION
---> Using cache
---> 7eb23a0fda9a
Step 4/25 : ARG DOCKER_COMPOSE_VERSION="1.27.4"
---> Using cache
---> a3a0ea202236
Step 5/25 : ENV RUNNER_NAME=""
---> Using cache
---> c0d5891a37a5
Step 6/25 : ENV RUNNER_WORK_DIRECTORY="_work"
---> Using cache
---> 445bc09045d5
Step 7/25 : ENV RUNNER_TOKEN=""
---> Using cache
---> 6b4339cd633c
Step 8/25 : ENV RUNNER_REPOSITORY_URL=""
---> Using cache
---> 26573524de0b
Step 9/25 : ENV RUNNER_LABELS=""
---> Using cache
---> 5dbad0e0337f
Step 10/25 : ENV RUNNER_ALLOW_RUNASROOT=true
---> Using cache
---> 50cb04b4e046
Step 11/25 : ENV GITHUB_ACCESS_TOKEN=""
---> Using cache
---> af07cf7d158c
Step 12/25 : ENV AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
---> Using cache
---> 919f89c7dd32
Step 13/25 : LABEL maintainer="[email protected]" org.label-schema.schema-version="1.0" org.label-schema.build-date=$BUILD_DATE org.label-schema.vcs-ref=$VCS_REF org.label-schema.name="tcardonne/github-runner" org.label-schema.description="Dockerized GitHub Actions runner." org.label-schema.url="https://github.com/tcardonne/docker-github-runner" org.label-schema.vcs-url="https://github.com/tcardonne/docker-github-runner" org.label-schema.vendor="Thomas Cardonne" org.label-schema.docker.cmd="docker run -it tcardonne/github-runner:latest"
---> Using cache
---> 26479b26a18b
Step 14/25 : RUN apk add --update-cache --no-cache curl unzip supervisor jq openssh-client git-lfs docker git tar bash nodejs libc6-compat
---> Using cache
---> a0affb0af605
Step 15/25 : COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
---> Using cache
---> 17f91d7b13ad
Step 16/25 : RUN chmod 644 /etc/supervisor/conf.d/supervisord.conf
---> Using cache
---> f746452a489f
Step 17/25 : RUN curl -L -o /usr/local/bin/docker-compose "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" && chmod +x /usr/local/bin/docker-compose
---> Using cache
---> 78f0d5f90839
Step 18/25 : RUN mkdir -p /home/runner ${AGENT_TOOLSDIRECTORY}
---> Using cache
---> eaaa8ddf0e19
Step 19/25 : WORKDIR /home/runner
---> Using cache
---> 58485604993f
Step 20/25 : RUN GH_RUNNER_VERSION=${GH_RUNNER_VERSION:-$(curl --silent "https://api.github.com/repos/actions/runner/releases/latest" | grep tag_name | sed -E 's/.*"v([^"]+)".*/\1/')} && curl -L -O https://github.com/actions/runner/releases/download/v${GH_RUNNER_VERSION}/actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz && tar -zxf actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz && rm -f actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz && chown -R root: /home/runner
---> Using cache
---> 3886c2db7e38
Step 21/25 : RUN ln -s /lib/libc.musl-x86_64.so.1 /lib/ld-linux-x86-64.so.2
---> Running in e8f95fe53f95
Removing intermediate container e8f95fe53f95
---> f5df3afd3c3a
Step 22/25 : COPY entrypoint.sh /entrypoint.sh
---> 6526902cac18
Step 23/25 : RUN chmod +x /entrypoint.sh
---> Running in f6a5747b22bc
Removing intermediate container f6a5747b22bc
---> 4e998315684c
Step 24/25 : ENTRYPOINT ["/entrypoint.sh"]
---> Running in 4a0820581a32
Removing intermediate container 4a0820581a32
---> a2a309d0309f
Step 25/25 : CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
---> Running in ab9aa069a4ac
Removing intermediate container ab9aa069a4ac
---> 52d96648aa89
Successfully built 52d96648aa89
Successfully tagged tcardonne/github-runner:latest
williamdes@williamdes:/mnt/Dev/@williamdes/docker-github-runner$ docker-compose up
Recreating docker-github-runner_runner_1 ... done
Attaching to docker-github-runner_runner_1
runner_1 | Exchanging the GitHub Access Token with a Runner Token (scope: repos)...
runner_1 | Error relocating ./bin/libcoreclr.so: __finite: symbol not found
runner_1 | Error relocating ./bin/libcoreclr.so: __isnan: symbol not found
runner_1 | Error relocating ./bin/libcoreclr.so: __finitef: symbol not found
runner_1 | Error relocating ./bin/libcoreclr.so: __isnanf: symbol not found
runner_1 | Error relocating ./bin/libcoreclr.so: pthread_attr_setaffinity_np: symbol not found
runner_1 | Libicu's dependencies is missing for Dotnet Core 3.0
runner_1 | Execute sudo ./bin/installdependencies.sh to install any missing Dotnet Core 3.0 dependencies.
runner_1 | Error relocating ./externals/node12/bin/node: gnu_get_libc_version: symbol not found
runner_1 | Error relocating ./externals/node12/bin/node: __register_atfork: symbol not found
runner_1 | Error relocating ./externals/node12/bin/node: __strdup: symbol not found
runner_1 | Error relocating ./externals/node12/bin/node: setcontext: symbol not found
runner_1 | Error relocating ./externals/node12/bin/node: makecontext: symbol not found
runner_1 | Error relocating ./externals/node12/bin/node: backtrace: symbol not found
runner_1 | Error relocating ./externals/node12/bin/node: getcontext: symbol not found
runner_1 | Error relocating ./externals/node12/bin/node: gnu_get_libc_version: symbol not found
runner_1 | Error relocating ./externals/node12/bin/node: __register_atfork: symbol not found
runner_1 | Error relocating ./externals/node12/bin/node: __strdup: symbol not found
runner_1 | Error relocating ./externals/node12/bin/node: setcontext: symbol not found
runner_1 | Error relocating ./externals/node12/bin/node: makecontext: symbol not found
runner_1 | Error relocating ./externals/node12/bin/node: backtrace: symbol not found
runner_1 | Error relocating ./externals/node12/bin/node: getcontext: symbol not found
runner_1 | Error relocating ./externals/node12/bin/node: gnu_get_libc_version: symbol not found
runner_1 | Error relocating ./externals/node12/bin/node: __register_atfork: symbol not found
runner_1 | Error relocating ./externals/node12/bin/node: __strdup: symbol not found
runner_1 | Error relocating ./externals/node12/bin/node: setcontext: symbol not found
runner_1 | Error relocating ./externals/node12/bin/node: makecontext: symbol not found
runner_1 | Error relocating ./externals/node12/bin/node: backtrace: symbol not found
runner_1 | Error relocating ./externals/node12/bin/node: getcontext: symbol not found
^CGracefully stopping... (press Ctrl+C again to force)
Stopping docker-github-runner_runner_1 ... done
the patch
diff --git a/docker/Dockerfile b/docker/Dockerfile
index b3dfd01..956bca2 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -1,8 +1,6 @@
-ARG FROM=debian:buster-slim
+ARG FROM=mcr.microsoft.com/dotnet/runtime-deps:3.1-alpine
FROM ${FROM}
-ARG DEBIAN_FRONTEND=noninteractive
-ARG GIT_VERSION="2.26.2"
ARG GH_RUNNER_VERSION
ARG DOCKER_COMPOSE_VERSION="1.27.4"
@@ -27,49 +25,30 @@ LABEL maintainer="[email protected]" \
org.label-schema.vendor="Thomas Cardonne" \
org.label-schema.docker.cmd="docker run -it tcardonne/github-runner:latest"
-RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
- apt-get install -y \
+RUN apk add --update-cache --no-cache \
curl \
unzip \
- apt-transport-https \
- ca-certificates \
- software-properties-common \
- sudo \
supervisor \
jq \
- iputils-ping \
- build-essential \
- zlib1g-dev \
- gettext \
- liblttng-ust0 \
- libcurl4-openssl-dev \
- openssh-client && \
- rm -rf /var/lib/apt/lists/* && \
- apt-get clean
+ openssh-client \
+ git-lfs \
+ docker \
+ git \
+ tar \
+ bash \
+ nodejs \
+ # Needed by the runner
+ libc6-compat \
+ && ln -s /lib/libc.musl-x86_64.so.1 /lib/ld-linux-x86-64.so.2
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN chmod 644 /etc/supervisor/conf.d/supervisord.conf
-# Install Docker CLI
-RUN curl -fsSL https://get.docker.com -o- | sh && \
- rm -rf /var/lib/apt/lists/* && \
- apt-get clean
-
# Install Docker-Compose
RUN curl -L -o /usr/local/bin/docker-compose \
"https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" && \
chmod +x /usr/local/bin/docker-compose
-RUN cd /tmp && \
- curl -sL -o git.tgz \
- https://www.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.gz && \
- tar zxf git.tgz && \
- cd git-${GIT_VERSION} && \
- ./configure --prefix=/usr && \
- make && \
- make install && \
- rm -rf /tmp/*
-
RUN mkdir -p /home/runner ${AGENT_TOOLSDIRECTORY}
WORKDIR /home/runner
@@ -78,10 +57,7 @@ RUN GH_RUNNER_VERSION=${GH_RUNNER_VERSION:-$(curl --silent "https://api.github.c
&& curl -L -O https://github.com/actions/runner/releases/download/v${GH_RUNNER_VERSION}/actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz \
&& tar -zxf actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz \
&& rm -f actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz \
- && ./bin/installdependencies.sh \
- && chown -R root: /home/runner \
- && rm -rf /var/lib/apt/lists/* \
- && apt-get clean
+ && chown -R root: /home/runner
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
@williamdes so the diff you shared, does that work? Why not open a PR?
@williamdes so the diff you shared, does that work? Why not open a PR?
Well as you can see on the output there is still 2 things I can not fix, if you find how to do I will open a pull-request :)
Another approach would be to add libc. I saw it in a different project the other day: https://github.com/disaster37/alpine-minio/blob/master/Dockerfile#L38

Basically they're patching libc into alpine to be able to run minio. Could work with the runner too
Still no success :worried:
Recreating docker-github-runner_runner_1 ... done
Attaching to docker-github-runner_runner_1
runner_1 | Exchanging the GitHub Access Token with a Runner Token (scope: repos)...
runner_1 | Error relocating ./bin/libcoreclr.so: __finite: symbol not found
runner_1 | Error relocating ./bin/libcoreclr.so: __isnan: symbol not found
runner_1 | Error relocating ./bin/libcoreclr.so: __finitef: symbol not found
runner_1 | Error relocating ./bin/libcoreclr.so: __isnanf: symbol not found
runner_1 | Error relocating ./bin/libcoreclr.so: pthread_attr_setaffinity_np: symbol not found
runner_1 | Libicu's dependencies is missing for Dotnet Core 3.0
runner_1 | Execute sudo ./bin/installdependencies.sh to install any missing Dotnet Core 3.0 dependencies.
runner_1 | ./externals/node12/bin/node: /usr/lib/libstdc++.so.6: no version information available (required by ./externals/node12/bin/node)
runner_1 | ./externals/node12/bin/node: /usr/lib/libstdc++.so.6: no version information available (required by ./externals/node12/bin/node)
runner_1 | ./externals/node12/bin/node: /usr/lib/libstdc++.so.6: no version information available (required by ./externals/node12/bin/node)
runner_1 | ./externals/node12/bin/node: /usr/lib/libstdc++.so.6: no version information available (required by ./externals/node12/bin/node)
runner_1 | ./externals/node12/bin/node: /usr/lib/libstdc++.so.6: no version information available (required by ./externals/node12/bin/node)
runner_1 | ./externals/node12/bin/node: /usr/lib/libstdc++.so.6: no version information available (required by ./externals/node12/bin/node)
runner_1 | ./externals/node12/bin/node: /usr/lib/libstdc++.so.6: no version information available (required by ./externals/node12/bin/node)
runner_1 | ./externals/node12/bin/node: /usr/lib/libstdc++.so.6: no version information available (required by ./externals/node12/bin/node)
runner_1 | Starting Runner listener with startup type: service
runner_1 | Started listener process
runner_1 | Started running service
runner_1 | /home/runner/bin/Runner.Listener: /usr/lib/libstdc++.so.6: no version information available (required by /home/runner/bin/Runner.Listener)
runner_1 | /home/runner/bin/Runner.Listener: /usr/lib/libstdc++.so.6: no version information available (required by /home/runner/bin/Runner.Listener)
runner_1 | /home/runner/bin/Runner.Listener: /usr/lib/libstdc++.so.6: no version information available (required by /home/runner/bin/Runner.Listener)
runner_1 | /home/runner/bin/Runner.Listener: /usr/lib/libstdc++.so.6: no version information available (required by /home/runner/bin/Runner.Listener)
runner_1 | /home/runner/bin/Runner.Listener: /usr/lib/libstdc++.so.6: no version information available (required by /home/runner/bin/Runner.Listener)
runner_1 | An error occurred: Not configured
runner_1 | Runner listener exited with error code 2
runner_1 | Runner listener exit with retryable error, re-launch runner in 5 seconds.
^CGracefully stopping... (press Ctrl+C again to force)
Stopping docker-github-runner_runner_1 ...
Killing docker-github-runner_runner_1 ... done
ARG FROM=mcr.microsoft.com/dotnet/runtime-deps:3.1-alpine
FROM ${FROM}
ARG GH_RUNNER_VERSION
ARG DOCKER_COMPOSE_VERSION="1.27.4"
ENV RUNNER_NAME=""
ENV RUNNER_WORK_DIRECTORY="_work"
ENV RUNNER_TOKEN=""
ENV RUNNER_REPOSITORY_URL=""
ENV RUNNER_LABELS=""
ENV RUNNER_ALLOW_RUNASROOT=true
ENV GITHUB_ACCESS_TOKEN=""
ENV AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
# Labels.
LABEL maintainer="[email protected]" \
org.label-schema.schema-version="1.0" \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.name="tcardonne/github-runner" \
org.label-schema.description="Dockerized GitHub Actions runner." \
org.label-schema.url="https://github.com/tcardonne/docker-github-runner" \
org.label-schema.vcs-url="https://github.com/tcardonne/docker-github-runner" \
org.label-schema.vendor="Thomas Cardonne" \
org.label-schema.docker.cmd="docker run -it tcardonne/github-runner:latest"
RUN apk add --update --no-cache \
curl \
unzip \
supervisor \
jq \
openssh-client \
git-lfs \
docker \
git \
tar \
bash \
# Needed by the runner
# Does not work more that without
libc6-compat \
# https://github.com/sgerrand/alpine-pkg-glibc/issues/80#issuecomment-574885208
# Does not work more that without
libstdc++
# && ln -s /lib/libc.musl-x86_64.so.1 /lib/ld-linux-x86-64.so.2 # not needed anymore with a newer glib version
ENV GLIBC_VERSION="2.32-r0"
RUN \
apk add --update --no-cache -t deps ca-certificates &&\
cd /tmp &&\
curl -# -L -o /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub &&\
curl -# -L -O https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk &&\
curl -# -L -O https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk &&\
apk add --force-overwrite glibc-${GLIBC_VERSION}.apk glibc-bin-${GLIBC_VERSION}.apk && rm *.apk &&\
/usr/glibc-compat/sbin/ldconfig /lib /usr/glibc-compat/lib/
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN chmod 644 /etc/supervisor/conf.d/supervisord.conf
# Install Docker-Compose
RUN curl -# -L -o /usr/local/bin/docker-compose \
"https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" && \
chmod +x /usr/local/bin/docker-compose
RUN mkdir -p /home/runner ${AGENT_TOOLSDIRECTORY}
WORKDIR /home/runner
RUN GH_RUNNER_VERSION=${GH_RUNNER_VERSION:-$(curl --silent "https://api.github.com/repos/actions/runner/releases/latest" | grep tag_name | sed -E 's/.*"v([^"]+)".*/\1/')} \
&& curl -# -L -O https://github.com/actions/runner/releases/download/v${GH_RUNNER_VERSION}/actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz \
&& tar -zxf actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz \
&& rm -f actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz \
&& chown -R root: /home/runner
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]