feat(runner): add ubuntu 24.04 support (#3598)
This commit is contained in:
parent
ee8ca99e49
commit
aa14f50e45
|
|
@ -1046,12 +1046,12 @@ func newRunnerPodWithContainerMode(containerMode string, template corev1.Pod, ru
|
||||||
// overridden
|
// overridden
|
||||||
if ok, _ := envVarPresent("DOCKER_GROUP_GID", dockerdContainer.Env); !ok {
|
if ok, _ := envVarPresent("DOCKER_GROUP_GID", dockerdContainer.Env); !ok {
|
||||||
gid := d.DockerGID
|
gid := d.DockerGID
|
||||||
// We default to gid 121 for Ubuntu 22.04 images
|
// We default to gid 121 for Ubuntu 22.04 and 24.04 images
|
||||||
// See below for more details
|
// See below for more details
|
||||||
// - https://github.com/actions/actions-runner-controller/issues/2490#issuecomment-1501561923
|
// - https://github.com/actions/actions-runner-controller/issues/2490#issuecomment-1501561923
|
||||||
// - https://github.com/actions/actions-runner-controller/blob/8869ad28bb5a1daaedefe0e988571fe1fb36addd/runner/actions-runner.ubuntu-20.04.dockerfile#L14
|
// - https://github.com/actions/actions-runner-controller/blob/8869ad28bb5a1daaedefe0e988571fe1fb36addd/runner/actions-runner.ubuntu-20.04.dockerfile#L14
|
||||||
// - https://github.com/actions/actions-runner-controller/blob/8869ad28bb5a1daaedefe0e988571fe1fb36addd/runner/actions-runner.ubuntu-22.04.dockerfile#L12
|
// - https://github.com/actions/actions-runner-controller/blob/8869ad28bb5a1daaedefe0e988571fe1fb36addd/runner/actions-runner.ubuntu-22.04.dockerfile#L12
|
||||||
if strings.Contains(runnerContainer.Image, "22.04") {
|
if strings.Contains(runnerContainer.Image, "22.04") || strings.Contains(runnerContainer.Image, "24.04") {
|
||||||
gid = "121"
|
gid = "121"
|
||||||
} else if strings.Contains(runnerContainer.Image, "20.04") {
|
} else if strings.Contains(runnerContainer.Image, "20.04") {
|
||||||
gid = "1001"
|
gid = "1001"
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ Create one using e.g. `eksctl`. You can refer to [the EKS documentation](https:/
|
||||||
|
|
||||||
Once you set up the service account, all you need is to add `serviceAccountName` and `fsGroup` to any pods that use the IAM-role enabled service account.
|
Once you set up the service account, all you need is to add `serviceAccountName` and `fsGroup` to any pods that use the IAM-role enabled service account.
|
||||||
|
|
||||||
`fsGroup` needs to be set to the UID of the `runner` Linux user that runs the runner agent (and dockerd in case you use dind-runner). For anyone using an Ubuntu 20.04 runner image it's `1000` and for Ubuntu 22.04 one it's `1001`.
|
`fsGroup` needs to be set to the UID of the `runner` Linux user that runs the runner agent (and dockerd in case you use dind-runner). For anyone using an Ubuntu 20.04 runner image it's `1000` and for Ubuntu 22.04 and 24.04 one it's `1001`.
|
||||||
|
|
||||||
For `RunnerDeployment`, you can set those two fields under the runner spec at `RunnerDeployment.Spec.Template`:
|
For `RunnerDeployment`, you can set those two fields under the runner spec at `RunnerDeployment.Spec.Template`:
|
||||||
|
|
||||||
|
|
@ -205,7 +205,7 @@ spec:
|
||||||
securityContext:
|
securityContext:
|
||||||
# For Ubuntu 20.04 runner
|
# For Ubuntu 20.04 runner
|
||||||
fsGroup: 1000
|
fsGroup: 1000
|
||||||
# Use 1001 for Ubuntu 22.04 runner
|
# Use 1001 for Ubuntu 22.04 and 24.04 runner
|
||||||
#fsGroup: 1001
|
#fsGroup: 1001
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
2
main.go
2
main.go
|
|
@ -124,7 +124,7 @@ func main() {
|
||||||
flag.StringVar(&leaderElectionId, "leader-election-id", "actions-runner-controller", "Controller id for leader election.")
|
flag.StringVar(&leaderElectionId, "leader-election-id", "actions-runner-controller", "Controller id for leader election.")
|
||||||
flag.StringVar(&runnerPodDefaults.RunnerImage, "runner-image", defaultRunnerImage, "The image name of self-hosted runner container to use by default if one isn't defined in yaml.")
|
flag.StringVar(&runnerPodDefaults.RunnerImage, "runner-image", defaultRunnerImage, "The image name of self-hosted runner container to use by default if one isn't defined in yaml.")
|
||||||
flag.StringVar(&runnerPodDefaults.DockerImage, "docker-image", defaultDockerImage, "The image name of docker sidecar container to use by default if one isn't defined in yaml.")
|
flag.StringVar(&runnerPodDefaults.DockerImage, "docker-image", defaultDockerImage, "The image name of docker sidecar container to use by default if one isn't defined in yaml.")
|
||||||
flag.StringVar(&runnerPodDefaults.DockerGID, "docker-gid", defaultDockerGID, "The default GID of docker group in the docker sidecar container. Use 1001 for dockerd sidecars of Ubuntu 20.04 runners 121 for Ubuntu 22.04.")
|
flag.StringVar(&runnerPodDefaults.DockerGID, "docker-gid", defaultDockerGID, "The default GID of docker group in the docker sidecar container. Use 1001 for dockerd sidecars of Ubuntu 20.04 runners 121 for Ubuntu 22.04 and 24.04.")
|
||||||
flag.Var(&runnerImagePullSecrets, "runner-image-pull-secret", "The default image-pull secret name for self-hosted runner container.")
|
flag.Var(&runnerImagePullSecrets, "runner-image-pull-secret", "The default image-pull secret name for self-hosted runner container.")
|
||||||
flag.StringVar(&runnerPodDefaults.DockerRegistryMirror, "docker-registry-mirror", "", "The default Docker Registry Mirror used by runners.")
|
flag.StringVar(&runnerPodDefaults.DockerRegistryMirror, "docker-registry-mirror", "", "The default Docker Registry Mirror used by runners.")
|
||||||
flag.StringVar(&c.Token, "github-token", c.Token, "The personal access token of GitHub.")
|
flag.StringVar(&c.Token, "github-token", c.Token, "The personal access token of GitHub.")
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,135 @@
|
||||||
|
FROM ubuntu:24.04
|
||||||
|
|
||||||
|
ARG TARGETPLATFORM
|
||||||
|
ARG RUNNER_VERSION
|
||||||
|
ARG RUNNER_CONTAINER_HOOKS_VERSION
|
||||||
|
# Docker and Docker Compose arguments
|
||||||
|
ENV CHANNEL=stable
|
||||||
|
ARG DOCKER_COMPOSE_VERSION=v2.23.0
|
||||||
|
ARG DUMB_INIT_VERSION=1.2.5
|
||||||
|
ARG RUNNER_USER_UID=1001
|
||||||
|
|
||||||
|
# Other arguments
|
||||||
|
ARG DEBUG=false
|
||||||
|
|
||||||
|
RUN test -n "$TARGETPLATFORM" || (echo "TARGETPLATFORM must be set" && false)
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
RUN apt-get update -y \
|
||||||
|
&& apt-get install -y software-properties-common \
|
||||||
|
&& add-apt-repository -y ppa:git-core/ppa \
|
||||||
|
&& apt-get update -y \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
curl \
|
||||||
|
ca-certificates \
|
||||||
|
git \
|
||||||
|
iproute2 \
|
||||||
|
iptables \
|
||||||
|
jq \
|
||||||
|
sudo \
|
||||||
|
uidmap \
|
||||||
|
unzip \
|
||||||
|
zip \
|
||||||
|
fuse-overlayfs \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Download latest git-lfs version
|
||||||
|
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
|
||||||
|
apt-get install -y --no-install-recommends git-lfs
|
||||||
|
|
||||||
|
# Runner user
|
||||||
|
RUN adduser --disabled-password --gecos "" --uid $RUNNER_USER_UID runner
|
||||||
|
|
||||||
|
ENV HOME=/home/runner
|
||||||
|
|
||||||
|
# Set-up subuid and subgid so that "--userns-remap=default" works
|
||||||
|
RUN set -eux; \
|
||||||
|
addgroup --system dockremap; \
|
||||||
|
adduser --system --ingroup dockremap dockremap; \
|
||||||
|
echo 'dockremap:165536:65536' >> /etc/subuid; \
|
||||||
|
echo 'dockremap:165536:65536' >> /etc/subgid
|
||||||
|
|
||||||
|
RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
||||||
|
&& if [ "$ARCH" = "arm64" ]; then export ARCH=aarch64 ; fi \
|
||||||
|
&& if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "i386" ]; then export ARCH=x86_64 ; fi \
|
||||||
|
&& curl -fLo /usr/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/dumb-init_${DUMB_INIT_VERSION}_${ARCH} \
|
||||||
|
&& chmod +x /usr/bin/dumb-init
|
||||||
|
|
||||||
|
ENV RUNNER_ASSETS_DIR=/runnertmp
|
||||||
|
RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
||||||
|
&& if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "i386" ]; then export ARCH=x64 ; fi \
|
||||||
|
&& mkdir -p "$RUNNER_ASSETS_DIR" \
|
||||||
|
&& cd "$RUNNER_ASSETS_DIR" \
|
||||||
|
&& curl -fLo runner.tar.gz https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-${ARCH}-${RUNNER_VERSION}.tar.gz \
|
||||||
|
&& tar xzf ./runner.tar.gz \
|
||||||
|
&& rm runner.tar.gz \
|
||||||
|
&& ./bin/installdependencies.sh \
|
||||||
|
&& mv ./externals ./externalstmp \
|
||||||
|
# libyaml-dev is required for ruby/setup-ruby action.
|
||||||
|
# It is installed after installdependencies.sh and before removing /var/lib/apt/lists
|
||||||
|
# to avoid rerunning apt-update on its own.
|
||||||
|
&& apt-get install -y libyaml-dev \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
ENV RUNNER_TOOL_CACHE=/opt/hostedtoolcache
|
||||||
|
RUN mkdir /opt/hostedtoolcache \
|
||||||
|
&& chgrp runner /opt/hostedtoolcache \
|
||||||
|
&& chmod g+rwx /opt/hostedtoolcache
|
||||||
|
|
||||||
|
RUN cd "$RUNNER_ASSETS_DIR" \
|
||||||
|
&& curl -fLo 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 -f runner-container-hooks.zip
|
||||||
|
|
||||||
|
# Make the rootless runner directory executable
|
||||||
|
RUN mkdir /run/user/1000 \
|
||||||
|
&& chown runner:runner /run/user/1000 \
|
||||||
|
&& chmod a+x /run/user/1000
|
||||||
|
|
||||||
|
# We place the scripts in `/usr/bin` so that users who extend this image can
|
||||||
|
# override them with scripts of the same name placed in `/usr/local/bin`.
|
||||||
|
COPY entrypoint-dind-rootless.sh startup.sh logger.sh graceful-stop.sh update-status /usr/bin/
|
||||||
|
RUN chmod +x /usr/bin/entrypoint-dind-rootless.sh /usr/bin/startup.sh
|
||||||
|
|
||||||
|
# Copy the docker shim which propagates the docker MTU to underlying networks
|
||||||
|
# to replace the docker binary in the PATH.
|
||||||
|
COPY docker-shim.sh /usr/local/bin/docker
|
||||||
|
|
||||||
|
# Configure hooks folder structure.
|
||||||
|
COPY hooks /etc/arc/hooks/
|
||||||
|
|
||||||
|
# Add the Python "User Script Directory" to the PATH
|
||||||
|
ENV PATH="${PATH}:${HOME}/.local/bin:/home/runner/bin"
|
||||||
|
ENV ImageOS=ubuntu22
|
||||||
|
ENV DOCKER_HOST=unix:///run/user/1000/docker.sock
|
||||||
|
ENV XDG_RUNTIME_DIR=/run/user/1000
|
||||||
|
|
||||||
|
RUN echo "PATH=${PATH}" > /etc/environment \
|
||||||
|
&& echo "ImageOS=${ImageOS}" >> /etc/environment \
|
||||||
|
&& echo "DOCKER_HOST=${DOCKER_HOST}" >> /etc/environment \
|
||||||
|
&& echo "XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR}" >> /etc/environment
|
||||||
|
|
||||||
|
# No group definition, as that makes it harder to run docker.
|
||||||
|
USER runner
|
||||||
|
|
||||||
|
# This will install docker under $HOME/bin according to the content of the script
|
||||||
|
RUN export SKIP_IPTABLES=1 \
|
||||||
|
&& curl -fsSL https://get.docker.com/rootless | sh \
|
||||||
|
&& /home/runner/bin/docker -v
|
||||||
|
|
||||||
|
RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
||||||
|
&& if [ "$ARCH" = "arm64" ]; then export ARCH=aarch64 ; fi \
|
||||||
|
&& if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "i386" ]; then export ARCH=x86_64 ; fi \
|
||||||
|
&& mkdir -p /home/runner/.docker/cli-plugins \
|
||||||
|
&& curl -fLo /home/runner/.docker/cli-plugins/docker-compose https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-linux-${ARCH} \
|
||||||
|
&& chmod +x /home/runner/.docker/cli-plugins/docker-compose \
|
||||||
|
&& ln -s /home/runner/.docker/cli-plugins/docker-compose /home/runner/bin/docker-compose \
|
||||||
|
&& which docker-compose \
|
||||||
|
&& docker compose version
|
||||||
|
|
||||||
|
# Create folder structure here to avoid permission issues
|
||||||
|
# when mounting the daemon.json file from a configmap.
|
||||||
|
RUN mkdir -p /home/runner/.config/docker
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/bash", "-c"]
|
||||||
|
CMD ["entrypoint-dind-rootless.sh"]
|
||||||
|
|
@ -0,0 +1,120 @@
|
||||||
|
FROM ubuntu:24.04
|
||||||
|
|
||||||
|
ARG TARGETPLATFORM
|
||||||
|
ARG RUNNER_VERSION
|
||||||
|
ARG RUNNER_CONTAINER_HOOKS_VERSION
|
||||||
|
# Docker and Docker Compose arguments
|
||||||
|
ARG CHANNEL=stable
|
||||||
|
ARG DOCKER_VERSION=24.0.7
|
||||||
|
ARG DOCKER_COMPOSE_VERSION=v2.23.0
|
||||||
|
ARG DUMB_INIT_VERSION=1.2.5
|
||||||
|
ARG RUNNER_USER_UID=1001
|
||||||
|
ARG DOCKER_GROUP_GID=121
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
RUN apt-get update -y \
|
||||||
|
&& apt-get install -y software-properties-common \
|
||||||
|
&& add-apt-repository -y ppa:git-core/ppa \
|
||||||
|
&& apt-get update -y \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
curl \
|
||||||
|
ca-certificates \
|
||||||
|
git \
|
||||||
|
iptables \
|
||||||
|
jq \
|
||||||
|
software-properties-common \
|
||||||
|
sudo \
|
||||||
|
unzip \
|
||||||
|
zip \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Download latest git-lfs version
|
||||||
|
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
|
||||||
|
apt-get install -y --no-install-recommends git-lfs
|
||||||
|
|
||||||
|
# Runner user
|
||||||
|
RUN adduser --disabled-password --gecos "" --uid $RUNNER_USER_UID runner \
|
||||||
|
&& groupadd docker --gid $DOCKER_GROUP_GID \
|
||||||
|
&& 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
|
||||||
|
|
||||||
|
ENV HOME=/home/runner
|
||||||
|
|
||||||
|
RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
||||||
|
&& if [ "$ARCH" = "arm64" ]; then export ARCH=aarch64 ; fi \
|
||||||
|
&& if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "i386" ]; then export ARCH=x86_64 ; fi \
|
||||||
|
&& curl -fLo /usr/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/dumb-init_${DUMB_INIT_VERSION}_${ARCH} \
|
||||||
|
&& chmod +x /usr/bin/dumb-init
|
||||||
|
|
||||||
|
ENV RUNNER_ASSETS_DIR=/runnertmp
|
||||||
|
RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
||||||
|
&& if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "i386" ]; then export ARCH=x64 ; fi \
|
||||||
|
&& mkdir -p "$RUNNER_ASSETS_DIR" \
|
||||||
|
&& cd "$RUNNER_ASSETS_DIR" \
|
||||||
|
&& curl -fLo runner.tar.gz https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-${ARCH}-${RUNNER_VERSION}.tar.gz \
|
||||||
|
&& tar xzf ./runner.tar.gz \
|
||||||
|
&& rm -f runner.tar.gz \
|
||||||
|
&& ./bin/installdependencies.sh \
|
||||||
|
# libyaml-dev is required for ruby/setup-ruby action.
|
||||||
|
# It is installed after installdependencies.sh and before removing /var/lib/apt/lists
|
||||||
|
# to avoid rerunning apt-update on its own.
|
||||||
|
&& apt-get install -y libyaml-dev \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
ENV RUNNER_TOOL_CACHE=/opt/hostedtoolcache
|
||||||
|
RUN mkdir /opt/hostedtoolcache \
|
||||||
|
&& chgrp docker /opt/hostedtoolcache \
|
||||||
|
&& chmod g+rwx /opt/hostedtoolcache
|
||||||
|
|
||||||
|
RUN cd "$RUNNER_ASSETS_DIR" \
|
||||||
|
&& curl -fLo 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 -f runner-container-hooks.zip
|
||||||
|
|
||||||
|
RUN set -vx; \
|
||||||
|
export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
||||||
|
&& if [ "$ARCH" = "arm64" ]; then export ARCH=aarch64 ; fi \
|
||||||
|
&& if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "i386" ]; then export ARCH=x86_64 ; fi \
|
||||||
|
&& curl -fLo docker.tgz https://download.docker.com/linux/static/${CHANNEL}/${ARCH}/docker-${DOCKER_VERSION}.tgz \
|
||||||
|
&& tar zxvf docker.tgz \
|
||||||
|
&& install -o root -g root -m 755 docker/* /usr/bin/ \
|
||||||
|
&& rm -rf docker docker.tgz
|
||||||
|
|
||||||
|
RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
||||||
|
&& if [ "$ARCH" = "arm64" ]; then export ARCH=aarch64 ; fi \
|
||||||
|
&& if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "i386" ]; then export ARCH=x86_64 ; fi \
|
||||||
|
&& mkdir -p /usr/libexec/docker/cli-plugins \
|
||||||
|
&& curl -fLo /usr/libexec/docker/cli-plugins/docker-compose https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-linux-${ARCH} \
|
||||||
|
&& chmod +x /usr/libexec/docker/cli-plugins/docker-compose \
|
||||||
|
&& ln -s /usr/libexec/docker/cli-plugins/docker-compose /usr/bin/docker-compose \
|
||||||
|
&& which docker-compose \
|
||||||
|
&& docker compose version
|
||||||
|
|
||||||
|
# We place the scripts in `/usr/bin` so that users who extend this image can
|
||||||
|
# override them with scripts of the same name placed in `/usr/local/bin`.
|
||||||
|
COPY entrypoint-dind.sh startup.sh logger.sh wait.sh graceful-stop.sh update-status /usr/bin/
|
||||||
|
RUN chmod +x /usr/bin/entrypoint-dind.sh /usr/bin/startup.sh
|
||||||
|
|
||||||
|
# Copy the docker shim which propagates the docker MTU to underlying networks
|
||||||
|
# to replace the docker binary in the PATH.
|
||||||
|
COPY docker-shim.sh /usr/local/bin/docker
|
||||||
|
|
||||||
|
# Configure hooks folder structure.
|
||||||
|
COPY hooks /etc/arc/hooks/
|
||||||
|
|
||||||
|
VOLUME /var/lib/docker
|
||||||
|
|
||||||
|
# Add the Python "User Script Directory" to the PATH
|
||||||
|
ENV PATH="${PATH}:${HOME}/.local/bin"
|
||||||
|
ENV ImageOS=ubuntu24
|
||||||
|
|
||||||
|
RUN echo "PATH=${PATH}" > /etc/environment \
|
||||||
|
&& echo "ImageOS=${ImageOS}" >> /etc/environment
|
||||||
|
|
||||||
|
# No group definition, as that makes it harder to run docker.
|
||||||
|
USER runner
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/bash", "-c"]
|
||||||
|
CMD ["entrypoint-dind.sh"]
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
FROM ubuntu:24.04
|
||||||
|
|
||||||
|
ARG TARGETPLATFORM
|
||||||
|
ARG RUNNER_VERSION
|
||||||
|
ARG RUNNER_CONTAINER_HOOKS_VERSION
|
||||||
|
# Docker and Docker Compose arguments
|
||||||
|
ARG CHANNEL=stable
|
||||||
|
ARG DOCKER_VERSION=24.0.7
|
||||||
|
ARG DOCKER_COMPOSE_VERSION=v2.23.0
|
||||||
|
ARG DUMB_INIT_VERSION=1.2.5
|
||||||
|
ARG RUNNER_USER_UID=1001
|
||||||
|
ARG DOCKER_GROUP_GID=121
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
RUN apt-get update -y \
|
||||||
|
&& apt-get install -y software-properties-common \
|
||||||
|
&& add-apt-repository -y ppa:git-core/ppa \
|
||||||
|
&& apt-get update -y \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
curl \
|
||||||
|
ca-certificates \
|
||||||
|
git \
|
||||||
|
jq \
|
||||||
|
sudo \
|
||||||
|
unzip \
|
||||||
|
zip \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Download latest git-lfs version
|
||||||
|
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
|
||||||
|
apt-get install -y --no-install-recommends git-lfs
|
||||||
|
|
||||||
|
RUN adduser --disabled-password --gecos "" --uid $RUNNER_USER_UID runner \
|
||||||
|
&& groupadd docker --gid $DOCKER_GROUP_GID \
|
||||||
|
&& 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
|
||||||
|
|
||||||
|
ENV HOME=/home/runner
|
||||||
|
|
||||||
|
RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
||||||
|
&& if [ "$ARCH" = "arm64" ]; then export ARCH=aarch64 ; fi \
|
||||||
|
&& if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "i386" ]; then export ARCH=x86_64 ; fi \
|
||||||
|
&& curl -fLo /usr/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/dumb-init_${DUMB_INIT_VERSION}_${ARCH} \
|
||||||
|
&& chmod +x /usr/bin/dumb-init
|
||||||
|
|
||||||
|
ENV RUNNER_ASSETS_DIR=/runnertmp
|
||||||
|
RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
||||||
|
&& if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "i386" ]; then export ARCH=x64 ; fi \
|
||||||
|
&& mkdir -p "$RUNNER_ASSETS_DIR" \
|
||||||
|
&& cd "$RUNNER_ASSETS_DIR" \
|
||||||
|
&& curl -fLo runner.tar.gz https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-${ARCH}-${RUNNER_VERSION}.tar.gz \
|
||||||
|
&& tar xzf ./runner.tar.gz \
|
||||||
|
&& rm runner.tar.gz \
|
||||||
|
&& ./bin/installdependencies.sh \
|
||||||
|
&& mv ./externals ./externalstmp \
|
||||||
|
# libyaml-dev is required for ruby/setup-ruby action.
|
||||||
|
# It is installed after installdependencies.sh and before removing /var/lib/apt/lists
|
||||||
|
# to avoid rerunning apt-update on its own.
|
||||||
|
&& apt-get install -y libyaml-dev \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
ENV RUNNER_TOOL_CACHE=/opt/hostedtoolcache
|
||||||
|
RUN mkdir /opt/hostedtoolcache \
|
||||||
|
&& chgrp docker /opt/hostedtoolcache \
|
||||||
|
&& chmod g+rwx /opt/hostedtoolcache
|
||||||
|
|
||||||
|
RUN cd "$RUNNER_ASSETS_DIR" \
|
||||||
|
&& curl -fLo 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 -f runner-container-hooks.zip
|
||||||
|
|
||||||
|
RUN set -vx; \
|
||||||
|
export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
||||||
|
&& if [ "$ARCH" = "arm64" ]; then export ARCH=aarch64 ; fi \
|
||||||
|
&& if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "i386" ]; then export ARCH=x86_64 ; fi \
|
||||||
|
&& curl -fLo docker.tgz https://download.docker.com/linux/static/${CHANNEL}/${ARCH}/docker-${DOCKER_VERSION}.tgz \
|
||||||
|
&& tar zxvf docker.tgz \
|
||||||
|
&& install -o root -g root -m 755 docker/docker /usr/bin/docker \
|
||||||
|
&& rm -rf docker docker.tgz
|
||||||
|
|
||||||
|
RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
||||||
|
&& if [ "$ARCH" = "arm64" ]; then export ARCH=aarch64 ; fi \
|
||||||
|
&& if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "i386" ]; then export ARCH=x86_64 ; fi \
|
||||||
|
&& mkdir -p /usr/libexec/docker/cli-plugins \
|
||||||
|
&& curl -fLo /usr/libexec/docker/cli-plugins/docker-compose https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-linux-${ARCH} \
|
||||||
|
&& chmod +x /usr/libexec/docker/cli-plugins/docker-compose \
|
||||||
|
&& ln -s /usr/libexec/docker/cli-plugins/docker-compose /usr/bin/docker-compose \
|
||||||
|
&& which docker-compose \
|
||||||
|
&& docker compose version
|
||||||
|
|
||||||
|
# We place the scripts in `/usr/bin` so that users who extend this image can
|
||||||
|
# override them with scripts of the same name placed in `/usr/local/bin`.
|
||||||
|
COPY entrypoint.sh startup.sh logger.sh graceful-stop.sh update-status /usr/bin/
|
||||||
|
|
||||||
|
# Copy the docker shim which propagates the docker MTU to underlying networks
|
||||||
|
# to replace the docker binary in the PATH.
|
||||||
|
COPY docker-shim.sh /usr/local/bin/docker
|
||||||
|
|
||||||
|
# Configure hooks folder structure.
|
||||||
|
COPY hooks /etc/arc/hooks/
|
||||||
|
|
||||||
|
# Add the Python "User Script Directory" to the PATH
|
||||||
|
ENV PATH="${PATH}:${HOME}/.local/bin/"
|
||||||
|
ENV ImageOS=ubuntu24
|
||||||
|
|
||||||
|
RUN echo "PATH=${PATH}" > /etc/environment \
|
||||||
|
&& echo "ImageOS=${ImageOS}" >> /etc/environment
|
||||||
|
|
||||||
|
USER runner
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/bash", "-c"]
|
||||||
|
CMD ["entrypoint.sh"]
|
||||||
Loading…
Reference in New Issue