-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend official actions/runner image #123
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
ARG BASE_IMAGE_OS=jammy | ||
FROM mcr.microsoft.com/dotnet/runtime-deps:6.0-${BASE_IMAGE_OS} | ||
|
||
ARG TARGETARCH | ||
ARG RUNNER_VERSION=2.309.0 | ||
ARG RUNNER_CONTAINER_HOOKS_VERSION=0.3.1 | ||
ARG DOCKER_VERSION=20.10.23 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update -y \ | ||
&& apt-get install -y --no-install-recommends \ | ||
sudo \ | ||
# extends https://github.com/actions/runner/blob/main/images/Dockerfile | ||
FROM ghcr.io/actions/actions-runner:${RUNNER_VERSION} | ||
|
||
RUN sudo apt-get update -y \ | ||
&& sudo apt-get install -y --no-install-recommends \ | ||
# packages in actions-runner-controller/runner-22.04 | ||
curl \ | ||
git \ | ||
|
@@ -35,47 +30,23 @@ RUN apt-get update -y \ | |
|
||
# keep /var/lib/apt/lists to reduce time of apt-get update in a job | ||
|
||
# set up the runner environment, | ||
# based on https://github.com/actions/runner/blob/v2.304.0/images/Dockerfile | ||
RUN adduser --disabled-password --gecos "" --uid 1001 runner \ | ||
&& groupadd docker --gid 123 \ | ||
&& usermod -aG sudo runner \ | ||
&& usermod -aG docker runner \ | ||
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \ | ||
&& echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers | ||
|
||
WORKDIR /home/runner | ||
RUN RUNNER_ARCH=x64 \ | ||
&& if [ "$TARGETARCH" = "arm64" ]; then RUNNER_ARCH=arm64 ; fi \ | ||
&& curl -f -L -o runner.tar.gz https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-${RUNNER_ARCH}-${RUNNER_VERSION}.tar.gz \ | ||
&& tar xzf ./runner.tar.gz \ | ||
&& rm runner.tar.gz | ||
|
||
RUN curl -f -L -o runner-container-hooks.zip https://github.com/actions/runner-container-hooks/releases/download/v${RUNNER_CONTAINER_HOOKS_VERSION}/actions-runner-hooks-k8s-${RUNNER_CONTAINER_HOOKS_VERSION}.zip \ | ||
&& unzip ./runner-container-hooks.zip -d ./k8s \ | ||
&& rm runner-container-hooks.zip | ||
|
||
RUN DOCKER_ARCH=x86_64 \ | ||
&& if [ "$TARGETARCH" = "arm64" ]; then DOCKER_ARCH=aarch64 ; fi \ | ||
&& curl -fLo docker.tgz https://download.docker.com/linux/static/stable/${DOCKER_ARCH}/docker-${DOCKER_VERSION}.tgz \ | ||
&& tar zxvf docker.tgz \ | ||
&& rm -rf docker.tgz \ | ||
&& install -o root -g root -m 755 docker/* /usr/bin/ \ | ||
&& rm -rf docker | ||
|
||
# some setup actions store cache into /opt/hostedtoolcache | ||
RUN mkdir /opt/hostedtoolcache \ | ||
&& chown runner:docker /opt/hostedtoolcache | ||
RUN sudo mkdir /opt/hostedtoolcache \ | ||
&& sudo chown runner:docker /opt/hostedtoolcache | ||
|
||
COPY entrypoint.sh / | ||
|
||
VOLUME /var/lib/docker | ||
|
||
# some setup actions depend on ImageOS variable | ||
# https://github.com/actions/runner-images/issues/345 | ||
ARG ImageOS=ubuntu22 | ||
ENV ImageOS=${ImageOS} | ||
ENV ImageOS=ubuntu22 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 It's because ubuntu20 will be supported by another Dockerfile |
||
|
||
# tini sends the signal to children | ||
ENV RUNNER_MANUALLY_TRAP_SIG= | ||
|
||
# disable the log by default, because it is too large | ||
ENV ACTIONS_RUNNER_PRINT_LOG_TO_STDOUT= | ||
Comment on lines
+45
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 Overwrite the settings of official image |
||
|
||
USER runner | ||
ENTRYPOINT ["/usr/bin/tini", "--", "/entrypoint.sh"] | ||
CMD ["/home/runner/run.sh"] |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Diff to the original https://github.com/quipper/actions-runner/blob/ade121bd15970cb70810e29987e76ef1c74c2157/Dockerfile # git diff 2a8b981 a847604 | pbcopy
diff --git a/2a8b981 b/a847604
index 2a8b981..a847604 100644
--- a/2a8b981
+++ b/a847604
@@ -1,10 +1,10 @@
-ARG BASE_IMAGE_OS=jammy
-FROM mcr.microsoft.com/dotnet/runtime-deps:6.0-${BASE_IMAGE_OS}
+FROM mcr.microsoft.com/dotnet/runtime-deps:6.0-focal
+ARG TARGETOS
ARG TARGETARCH
ARG RUNNER_VERSION=2.309.0
-ARG RUNNER_CONTAINER_HOOKS_VERSION=0.3.1
-ARG DOCKER_VERSION=20.10.23
+ARG RUNNER_CONTAINER_HOOKS_VERSION=0.3.2
+ARG DOCKER_VERSION=23.0.6
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y \
@@ -36,7 +36,7 @@ RUN apt-get update -y \
# keep /var/lib/apt/lists to reduce time of apt-get update in a job
# set up the runner environment,
-# based on https://github.com/actions/runner/blob/v2.304.0/images/Dockerfile
+# based on https://github.com/actions/runner/blob/v2.309.0/images/Dockerfile
RUN adduser --disabled-password --gecos "" --uid 1001 runner \
&& groupadd docker --gid 123 \
&& usermod -aG sudo runner \
@@ -45,9 +45,9 @@ RUN adduser --disabled-password --gecos "" --uid 1001 runner \
&& echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers
WORKDIR /home/runner
-RUN RUNNER_ARCH=x64 \
- && if [ "$TARGETARCH" = "arm64" ]; then RUNNER_ARCH=arm64 ; fi \
- && curl -f -L -o runner.tar.gz https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-${RUNNER_ARCH}-${RUNNER_VERSION}.tar.gz \
+RUN export RUNNER_ARCH=${TARGETARCH} \
+ && if [ "$RUNNER_ARCH" = "amd64" ]; then export RUNNER_ARCH=x64 ; fi \
+ && curl -f -L -o runner.tar.gz https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-${TARGETOS}-${RUNNER_ARCH}-${RUNNER_VERSION}.tar.gz \
&& tar xzf ./runner.tar.gz \
&& rm runner.tar.gz
@@ -55,9 +55,10 @@ RUN curl -f -L -o runner-container-hooks.zip https://github.com/actions/runner-c
&& unzip ./runner-container-hooks.zip -d ./k8s \
&& rm runner-container-hooks.zip
-RUN DOCKER_ARCH=x86_64 \
- && if [ "$TARGETARCH" = "arm64" ]; then DOCKER_ARCH=aarch64 ; fi \
- && curl -fLo docker.tgz https://download.docker.com/linux/static/stable/${DOCKER_ARCH}/docker-${DOCKER_VERSION}.tgz \
+RUN export RUNNER_ARCH=${TARGETARCH} \
+ && if [ "$RUNNER_ARCH" = "amd64" ]; then export DOCKER_ARCH=x86_64 ; fi \
+ && if [ "$RUNNER_ARCH" = "arm64" ]; then export DOCKER_ARCH=aarch64 ; fi \
+ && curl -fLo docker.tgz https://download.docker.com/${TARGETOS}/static/stable/${DOCKER_ARCH}/docker-${DOCKER_VERSION}.tgz \
&& tar zxvf docker.tgz \
&& rm -rf docker.tgz \
&& install -o root -g root -m 755 docker/* /usr/bin/ \
@@ -73,8 +74,7 @@ VOLUME /var/lib/docker
# some setup actions depend on ImageOS variable
# https://github.com/actions/runner-images/issues/345
-ARG ImageOS=ubuntu22
-ENV ImageOS=${ImageOS}
+ENV ImageOS=ubuntu20
USER runner
ENTRYPOINT ["/usr/bin/tini", "--", "/entrypoint.sh"] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. arch/armの部分に関してはやりたいことは同じと読み取ったのですが、 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 説明不足でした 🙏 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
FROM mcr.microsoft.com/dotnet/runtime-deps:6.0-focal | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG RUNNER_VERSION=2.309.0 | ||
ARG RUNNER_CONTAINER_HOOKS_VERSION=0.3.2 | ||
ARG DOCKER_VERSION=23.0.6 | ||
Comment on lines
+6
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update -y \ | ||
&& apt-get install -y --no-install-recommends \ | ||
sudo \ | ||
# packages in actions-runner-controller/runner-22.04 | ||
curl \ | ||
git \ | ||
jq \ | ||
unzip \ | ||
zip \ | ||
# packages in actions-runner-controller/runner-20.04 | ||
build-essential \ | ||
locales \ | ||
tzdata \ | ||
# ruby/setup-ruby dependencies | ||
# https://github.com/ruby/setup-ruby#using-self-hosted-runners | ||
libyaml-dev \ | ||
# dockerd dependencies | ||
tini \ | ||
iptables | ||
|
||
# KEEP LESS PACKAGES: | ||
# We'd like to keep this image small for maintanability and security. | ||
# See also, | ||
# https://github.com/actions/actions-runner-controller/pull/2050 | ||
# https://github.com/actions/actions-runner-controller/blob/master/runner/actions-runner.ubuntu-22.04.dockerfile | ||
|
||
# keep /var/lib/apt/lists to reduce time of apt-get update in a job | ||
|
||
# set up the runner environment, | ||
# based on https://github.com/actions/runner/blob/v2.309.0/images/Dockerfile | ||
RUN adduser --disabled-password --gecos "" --uid 1001 runner \ | ||
&& groupadd docker --gid 123 \ | ||
&& usermod -aG sudo runner \ | ||
&& usermod -aG docker runner \ | ||
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \ | ||
&& echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers | ||
Comment on lines
+40
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
WORKDIR /home/runner | ||
RUN export RUNNER_ARCH=${TARGETARCH} \ | ||
&& if [ "$RUNNER_ARCH" = "amd64" ]; then export RUNNER_ARCH=x64 ; fi \ | ||
&& curl -f -L -o runner.tar.gz https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-${TARGETOS}-${RUNNER_ARCH}-${RUNNER_VERSION}.tar.gz \ | ||
&& tar xzf ./runner.tar.gz \ | ||
&& rm runner.tar.gz | ||
|
||
RUN curl -f -L -o runner-container-hooks.zip https://github.com/actions/runner-container-hooks/releases/download/v${RUNNER_CONTAINER_HOOKS_VERSION}/actions-runner-hooks-k8s-${RUNNER_CONTAINER_HOOKS_VERSION}.zip \ | ||
&& unzip ./runner-container-hooks.zip -d ./k8s \ | ||
&& rm runner-container-hooks.zip | ||
|
||
RUN export RUNNER_ARCH=${TARGETARCH} \ | ||
&& if [ "$RUNNER_ARCH" = "amd64" ]; then export DOCKER_ARCH=x86_64 ; fi \ | ||
&& if [ "$RUNNER_ARCH" = "arm64" ]; then export DOCKER_ARCH=aarch64 ; fi \ | ||
&& curl -fLo docker.tgz https://download.docker.com/${TARGETOS}/static/stable/${DOCKER_ARCH}/docker-${DOCKER_VERSION}.tgz \ | ||
&& tar zxvf docker.tgz \ | ||
&& rm -rf docker.tgz \ | ||
&& install -o root -g root -m 755 docker/* /usr/bin/ \ | ||
&& rm -rf docker | ||
Comment on lines
+48
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
# some setup actions store cache into /opt/hostedtoolcache | ||
RUN mkdir /opt/hostedtoolcache \ | ||
&& chown runner:docker /opt/hostedtoolcache | ||
|
||
COPY entrypoint.sh / | ||
|
||
VOLUME /var/lib/docker | ||
|
||
# some setup actions depend on ImageOS variable | ||
# https://github.com/actions/runner-images/issues/345 | ||
ENV ImageOS=ubuntu20 | ||
|
||
USER runner | ||
ENTRYPOINT ["/usr/bin/tini", "--", "/entrypoint.sh"] | ||
CMD ["/home/runner/run.sh"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Built from https://github.com/actions/runner/blob/v2.309.0/images/Dockerfile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Dockerfile of base image