-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (51 loc) · 2.06 KB
/
Dockerfile
File metadata and controls
65 lines (51 loc) · 2.06 KB
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
FROM ubuntu:22.04
# Avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive
# Install essential dependencies only
RUN apt-get update && apt-get install -y \
curl \
wget \
git \
jq \
build-essential \
libssl-dev \
python3 \
python3-pip \
ca-certificates \
gnupg \
lsb-release \
sudo \
&& rm -rf /var/lib/apt/lists/*
# Install Docker CLI for Docker-on-host usage (most efficient approach)
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg \
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \
&& apt-get update \
&& apt-get install -y docker-ce-cli docker-compose-plugin \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js (commonly needed for GitHub Actions)
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Create a user for the runner
RUN useradd -m -s /bin/bash runner \
&& usermod -aG sudo runner \
&& echo "runner ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# Switch to runner user
USER runner
WORKDIR /home/runner
# Follow GitHub's official steps exactly
# Create a folder
RUN mkdir actions-runner && cd actions-runner
WORKDIR /home/runner/actions-runner
# Download the latest runner package (GitHub official step)
RUN curl -o actions-runner-linux-x64-2.326.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.326.0/actions-runner-linux-x64-2.326.0.tar.gz
# Extract the installer (GitHub official step)
RUN tar xzf ./actions-runner-linux-x64-2.326.0.tar.gz \
&& rm actions-runner-linux-x64-2.326.0.tar.gz
# Install runner dependencies
RUN sudo ./bin/installdependencies.sh
# Copy entrypoint script
COPY --chown=runner:runner entrypoint.sh /home/runner/entrypoint.sh
RUN chmod +x /home/runner/entrypoint.sh
WORKDIR /home/runner/actions-runner
ENTRYPOINT ["/home/runner/entrypoint.sh"]