1+ FROM ubuntu:20.04
2+
3+ COPY export-aarch-infos.sh /export-aarch-infos.sh
4+ RUN chmod +x /export-aarch-infos.sh
5+
6+ ARG DEBIAN_FRONTEND=noninteractive
7+
8+ ENV USERNAME="runner"
9+ ENV RUNNER_HOME="/home/${USERNAME}/runner"
10+ ENV GH_WORKDIR="/home/${USERNAME}"
11+
12+ # https://github.com/actions/runner/releases
13+ ENV GH_RUNNER_VERSION=2.289.1
14+ ENV GH_RUNNER_LABELS=ubuntu-20.04
15+
16+ ENV AWESOME_CI_VERSION 0.11.1
17+
18+ # install packages along with jq so we can parse JSON
19+ # add additional packages as necessary
20+ ARG PACKAGES="libffi-dev libicu-dev build-essential libssl-dev ca-certificates jq sed grep git curl wget zip"
21+
22+ RUN apt-get update \
23+ && apt-get install -y ${PACKAGES} \
24+ && rm -rf /var/lib/apt/lists/* \
25+ && apt-get clean
26+
27+ # install awesoeme ci
28+ RUN export ARCH=$(/export-aarch-infos.sh a-short) \
29+ && curl -L -O https://github.com/eksrvb/awesome-ci/releases/download/${AWESOME_CI_VERSION}/awesome-ci_${AWESOME_CI_VERSION}_${ARCH} \
30+ && mv awesome-ci_${AWESOME_CI_VERSION}_${ARCH} /usr/local/src/awesome-ci_${AWESOME_CI_VERSION}_${ARCH} \
31+ && chmod +x /usr/local/src/awesome-ci_${AWESOME_CI_VERSION}_${ARCH} \
32+ && ln -s /usr/local/src/awesome-ci_${AWESOME_CI_VERSION}_${ARCH} /usr/local/bin/
33+
34+ WORKDIR /home/${USERNAME}/runner
35+
36+ # add a non-sudo user
37+ RUN useradd -m $USERNAME \
38+ && usermod -aG sudo $USERNAME \
39+ && chown -R $USERNAME /home/${USERNAME} \
40+ && mkdir -p ${RUNNER_HOME}
41+
42+ # Install github runner
43+ RUN export ARCH=$(/export-aarch-infos.sh x-short) \
44+ && curl -L -O https://github.com/actions/runner/releases/download/v${GH_RUNNER_VERSION}/actions-runner-linux-${ARCH}-${GH_RUNNER_VERSION}.tar.gz \
45+ && tar -zxf actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz \
46+ && rm -f actions-runner-linux-x64-${GH_RUNNER_VERSION}.tar.gz \
47+ && ./bin/installdependencies.sh \
48+ && cd ./bin \
49+ && apt-get clean
50+
51+ # copy over the start script
52+ COPY gh-entrypoint.sh /gh-entrypoint.sh
53+ # make the script executable
54+ RUN chmod +x /gh-entrypoint.sh
55+
56+ RUN chown -R $USERNAME /home/${USERNAME}
57+ RUN chown -R $USERNAME /gh-entrypoint.sh
58+
59+ # set the entrypoint to the entrypoint.sh script
60+ ENTRYPOINT ["/gh-entrypoint.sh" ]
61+
62+ USER $USERNAME
0 commit comments