This repository was archived by the owner on Apr 3, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (40 loc) · 1.87 KB
/
Dockerfile
File metadata and controls
51 lines (40 loc) · 1.87 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
# Newer versions of Ubuntu just completely fail to work because of some dependency issues
# Not going to bother trying to fix it either, given that 22.04 is still in support
FROM ubuntu:22.04
# Arguments for setting up the image
ARG RUNNER_VERSION="latest"
# Update system, install necessary packages,
RUN apt-get update && \
apt-get upgrade && \
apt-get install -y git ca-certificates curl unzip sudo && \
install -m 0755 -d /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc && \
chmod a+r /etc/apt/keyrings/docker.asc && \
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" \
| tee /etc/apt/sources.list.d/docker.list > /dev/null && \
apt-get update && \
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Create a folder for actions
RUN mkdir /actions-runner
WORKDIR /actions-runner
# Copy install script
COPY ./scripts/install.sh /
# Download and extract the latest runner package
RUN sed -i 's/\r$//' /install.sh && chmod +x /install.sh && bash /install.sh
RUN rm -f /install.sh
# Set up and runner account for configuration
RUN useradd -ms /bin/bash runner && usermod -aG sudo runner && usermod -aG docker runner
RUN echo 'runner ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN chown -R runner:runner /actions-runner
# Switch to runner user
USER runner
# Install missing dependencies
RUN sudo ./bin/installdependencies.sh
# Clear apt cache
RUN sudo rm -rf /var/lib/apt/lists/*
# Copy init script
COPY ./scripts/init.sh /actions-runner
RUN sed -i 's/\r$//' /actions-runner/init.sh && chmod +rx /actions-runner/init.sh
# Command to run when the container starts
CMD [ "/actions-runner/init.sh" ]