-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
52 lines (45 loc) · 1.78 KB
/
Dockerfile
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
FROM debian:latest
# Install required packages
RUN apt-get update \
&& apt-get install -y \
curl \
sudo \
git \
jq \
tar \
gnupg2 \
python3 \
apt-transport-https \
ca-certificates \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Create rootless user
RUN useradd -m github && \
usermod -aG sudo github && \
echo "%sudo ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# Install docker in docker
RUN curl -sSL https://get.docker.com/ | bash && \
usermod -aG docker github
# Use rootless user
USER github
WORKDIR /home/github
# Download & install latest version of runner
RUN RUNNER_VERSION=$(curl https://api.github.com/repos/actions/runner/releases | jq '.[0].name') && \
RUNNER_VERSION=$(echo $RUNNER_VERSION | sed 's/"//g') && \
RUNNER_VERSION=$(echo $RUNNER_VERSION | sed 's/v//g') && \
KERNEL_VERSION=$(uname -m) && \
KERNEL_VERSION=$(echo $KERNEL_VERSION | sed 's/86_//g') && \
KERNEL_VERSION=$(echo $KERNEL_VERSION | sed 's/v6l//g') && \
KERNEL_VERSION=$(echo $KERNEL_VERSION | sed 's/v7l//g') && \
KERNEL_VERSION=$(echo $KERNEL_VERSION | sed 's/v8l//g') && \
KERNEL_VERSION=$(echo $KERNEL_VERSION | sed 's/aarch64/arm64/g') && \
curl -O -L https://github.com/actions/runner/releases/download/v$RUNNER_VERSION/actions-runner-linux-$KERNEL_VERSION-$RUNNER_VERSION.tar.gz \
&& tar xzf ./actions-runner-linux-$KERNEL_VERSION-$RUNNER_VERSION.tar.gz \
&& rm -f ./actions-runner-linux-$KERNEL_VERSION-$RUNNER_VERSION.tar.gz
RUN sudo ./bin/installdependencies.sh
# Prepare entrypoint
COPY --chown=github:github entrypoint.sh ./entrypoint.sh
RUN sudo chmod u+x ./entrypoint.sh
# Run the container from entrypoint
ENTRYPOINT ["/home/github/entrypoint.sh"]