11# Self-Hosted IBM Power Github Actions Runner.
2-
3-
4- # Stage 1: Main image for ppc64le Ubuntu
52FROM ubuntu:22.04
63
74# Set non-interactive mode for apt
85ENV DEBIAN_FRONTEND=noninteractive
96
10- # Fix sources to point to ports.ubuntu.com for ppc64le
7+ # Fix sources for ppc64le and update system
118RUN echo "deb [arch=ppc64el] http://ports.ubuntu.com/ubuntu-ports jammy main restricted universe multiverse" > /etc/apt/sources.list && \
129 echo "deb [arch=ppc64el] http://ports.ubuntu.com/ubuntu-ports jammy-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
1310 echo "deb [arch=ppc64el] http://ports.ubuntu.com/ubuntu-ports jammy-backports main restricted universe multiverse" >> /etc/apt/sources.list && \
14- echo "deb [arch=ppc64el] http://ports.ubuntu.com/ubuntu-ports jammy-security main restricted universe multiverse" >> /etc/apt/sources.list
15-
16- # Update and install basic tools
17- RUN apt-get clean && rm -rf /var/lib/apt/lists/* && \
11+ echo "deb [arch=ppc64el] http://ports.ubuntu.com/ubuntu-ports jammy-security main restricted universe multiverse" >> /etc/apt/sources.list && \
12+ apt-get clean && \
1813 apt-get update -o Acquire::Retries=5 -o Acquire::http::Timeout="10" && \
1914 apt-get -y install --no-install-recommends \
2015 build-essential \
@@ -24,94 +19,73 @@ RUN apt-get clean && rm -rf /var/lib/apt/lists/* && \
2419 gnupg-agent \
2520 iptables \
2621 ca-certificates \
27- software-properties-common && \
22+ software-properties-common \
23+ vim \
24+ python3 \
25+ python3-pip \
26+ docker-ce \
27+ docker-ce-cli \
28+ containerd.io && \
29+ update-alternatives --set iptables /usr/sbin/iptables-legacy && \
30+ update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy && \
2831 apt-get clean && rm -rf /var/lib/apt/lists/*
2932
30- # Switch to iptables-legacy
31- RUN update-alternatives --set iptables /usr/sbin/iptables-legacy && \
32- update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
33-
3433# Add Docker GPG key and repository
3534RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg && \
3635 echo "deb [arch=ppc64el signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list && \
37- apt-get update && apt-get install -y \
38- docker-ce \
39- docker-ce-cli \
40- containerd.io && \
36+ apt-get update && apt-get install -y docker-ce docker-ce-cli containerd.io && \
4137 apt-get clean && rm -rf /var/lib/apt/lists/*
4238
43- # Replace apt sources for ppc64el
44- RUN sed -i 's|http://archive.ubuntu.com/ubuntu|http://ports.ubuntu.com/ubuntu-ports|g' /etc/apt/sources.list && \
45- sed -i 's|http://security.ubuntu.com/ubuntu|http://ports.ubuntu.com/ubuntu-ports|g' /etc/apt/sources.list
46-
47- # Install additional dependencies
48- RUN apt-get update && apt-get install -y \
49- vim \
50- python3 \
51- python3-dev \
52- python3-pip \
53- virtualenv && \
39+ # Install dotnet SDK and other dependencies
40+ RUN apt-get update && apt-get install -y --no-install-recommends \
41+ wget \
42+ git \
43+ dotnet-sdk-8.0 \
44+ cmake \
45+ make \
46+ automake \
47+ autoconf \
48+ m4 \
49+ libtool && \
5450 apt-get clean && rm -rf /var/lib/apt/lists/*
5551
56- # Set up Python virtual environment
57- RUN virtualenv --system-site-packages venv
58-
59- # Copy custom scripts
60- COPY fs/ /
61- RUN chmod 777 /usr/bin/actions-runner /usr/bin/entrypoint
62-
63-
64- # installing and configuring the runner
65-
66- ARG RUNNERREPO="https://github.com/actions/runner" RUNNERPATCH
67-
68- RUN apt-get -qq update -y && \
69- apt-get -qq -y install wget git sudo curl dotnet-sdk-8.0 && \
70- apt autoclean
71-
72- RUN echo "Using SDK - `dotnet --version`"
73-
74- ADD ${RUNNERPATCH} /tmp/runner.patch
75-
76- RUN cd /tmp && \
77- git clone -q ${RUNNERREPO} && \
78- cd runner && \
79- git checkout main -b build && \
80- git apply /tmp/runner.patch && \
81- sed -i'' -e /version/s/8......\" $/${SDK}.0.100\" / src/global.json
82-
83-
84- RUN cd /tmp/runner/src && \
85- ./dev.sh layout && \
86- ./dev.sh package && \
87- ./dev.sh test && \
88- rm -rf /root/.dotnet /root/.nuget
89-
90-
9152
53+ # Setup user and permissions
9254RUN useradd -c "Action Runner" -m runner && \
9355 usermod -L runner && \
94- echo "runner ALL=(ALL) NOPASSWD: ALL" >/etc/sudoers.d/runner && \
56+ echo "runner ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/runner && \
9557 groupadd docker || true && \
9658 usermod -aG docker runner && \
97- echo "Fixing permissions at runtime if /var/run/docker.sock exists" && \
9859 (test -S /var/run/docker.sock && chmod 660 /var/run/docker.sock && chgrp docker /var/run/docker.sock || true)
9960
10061
101- RUN mkdir -p /opt/runner && \
102- tar -xf /tmp/runner/_package/*.tar.gz -C /opt/runner && \
103- chown -R runner:runner /opt/runner && \
104- su -c "/opt/runner/config.sh --version" runner
62+ # Add and configure GitHub Actions runner
63+ ARG RUNNERREPO="https://github.com/actions/runner"
64+ ARG RUNNERPATCH
65+
66+ ADD ${RUNNERPATCH} /tmp/runner.patch
10567
106- RUN apt-get -qq -y install cmake make automake autoconf m4 gcc-12-base libtool
68+ RUN git clone -q ${RUNNERREPO} /tmp/runner && \
69+ cd /tmp/runner && \
70+ git checkout main -b build && \
71+ git apply /tmp/runner.patch && \
72+ sed -i'' -e /version/s/8......\" $/${SDK}.0.100\" / src/global.json \
73+ ./dev.sh layout && ./dev.sh package && ./dev.sh test && \
74+ tar -xf /tmp/runner/_package/*.tar.gz -C /opt/runner && \
75+ chown -R runner:runner /opt/runner && \
76+ rm -rf /tmp/runner /tmp/runner.patch /root/.dotnet /root/.nuget
10777
108- RUN rm -rf /tmp/runner /tmp/runner.patch
78+ # Copy custom scripts and set permissions
79+ COPY fs/ /
80+ RUN chmod 777 /usr/bin/actions-runner /usr/bin/entrypoint
10981
110- USER runner
82+ # Switch to the runner user
83+ USER runner
11184
11285# Set working directory
11386WORKDIR /opt/runner
11487
88+ # Define entry point and command
11589ENTRYPOINT ["/usr/bin/entrypoint" ]
11690CMD ["/usr/bin/actions-runner" ]
11791
0 commit comments