-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend official actions/runner image (#123)
* Extend official actions/runner image * Align with official Dockerfile * Fix Renovate * Update DOCKER_VERSION
- Loading branch information
Showing
6 changed files
with
106 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
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 | ||
|
||
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 | ||
|
||
# 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"] |