-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile.ubuntu20
83 lines (70 loc) · 3.15 KB
/
Dockerfile.ubuntu20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
FROM mcr.microsoft.com/dotnet/runtime-deps:6.0-focal
ARG TARGETOS
ARG TARGETARCH
ARG RUNNER_VERSION=2.320.0
ARG RUNNER_CONTAINER_HOOKS_VERSION=0.3.2
ARG DOCKER_VERSION=24.0.6
# DO NOT ADD ANY PACKAGE!
# We'd like to keep this image small for long-term maintanability and security.
# If you want to install a package, use https://aquaproj.github.io in your workflow.
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
# 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
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
iptables \
&& rm -rf /var/lib/apt/lists/*
# 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
ENV RUNNER_TOOL_CACHE=/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
# Align to GitHub-hosted runners (ubuntu-latest)
ENV LANG=C.UTF-8
USER runner
ENTRYPOINT ["/usr/bin/docker-init", "--", "/entrypoint.sh"]
CMD ["/home/runner/run.sh"]