-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy paths390x.Dockerfile
More file actions
82 lines (61 loc) · 2.88 KB
/
s390x.Dockerfile
File metadata and controls
82 lines (61 loc) · 2.88 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Self-Hosted IBM Z Github Actions Runner
ARG RUNNER_VERSION=2.331.0
FROM ubuntu:noble AS build-s390x-runner-binaries
ENV DEBIAN_FRONTEND=noninteractive
ARG S390X_RUNNER_REPO="https://github.com/ppc64le/gaplib.git"
ARG S390X_RUNNER_REPO_REV=main
ARG S390X_PATCH=patches/runner-main-sdk8-s390x.patch
ARG RUNNER_REPO="https://github.com/actions/runner"
ARG RUNNER_VERSION
RUN apt-get update -y
RUN apt-get -y install curl git jq sudo wget
RUN apt-get -y install dotnet-sdk-8.0
RUN git clone ${S390X_RUNNER_REPO} /opt/s390x-runner
WORKDIR /opt/s390x-runner
RUN git checkout ${S390X_RUNNER_REPO_REV}
RUN cp ${S390X_PATCH} /opt/runner.patch
RUN git clone -b v${RUNNER_VERSION} ${RUNNER_REPO} /opt/runner
WORKDIR /opt/runner
RUN git apply /opt/runner.patch
# dotnet refuses to build if global.json version and dotnet version don't match
# it's difficult to get the right version of dotnet on s390x (the best way is to build it)
# so replacing the version in global.json is an acceptable workaround
RUN jq --arg ver "$(dotnet --version)" '.sdk.version = $ver' src/global.json > tmp.json && \
mv tmp.json src/global.json
WORKDIR /opt/runner/src
RUN ./dev.sh layout
RUN ./dev.sh package
RUN ./dev.sh test
RUN mv "/opt/runner/_package/actions-runner-linux-s390x-${RUNNER_VERSION#v}.tar.gz" /opt/runner.tar.gz
FROM ubuntu:noble AS prepare-runner-image
ENV DEBIAN_FRONTEND=noninteractive
ARG RUNNER_HOME=/actions-runner
ARG RUNNER_VERSION
RUN apt-get update -y
# see https://github.com/myoung34/docker-github-actions-runner/blob/master/build/install_base.sh#L5
RUN apt-get install -y --no-install-recommends \
apt-transport-https ca-certificates curl dirmngr dumb-init git gnupg \
gosu gpg-agent jq libc-bin locales lsb-release \
software-properties-common sudo tar unzip wget zip zstd
COPY install-dependencies.sh /tmp/install-dependencies.sh
RUN /tmp/install-dependencies.sh run
RUN apt-get -y install aspnetcore-runtime-8.0
RUN apt-get clean
# Copy scripts from myoung34/docker-github-actions-runner
RUN curl -Lf https://raw.githubusercontent.com/myoung34/docker-github-actions-runner/${RUNNER_VERSION}/entrypoint.sh -o /entrypoint.sh && chmod 755 /entrypoint.sh
# RUN curl -Lf https://raw.githubusercontent.com/myoung34/docker-github-actions-runner/${RUNNER_VERSION}/token.sh -o /token.sh && chmod 755 /token.sh
COPY token.sh /token.sh
RUN useradd -d ${RUNNER_HOME} -m runner
RUN echo "runner ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers
RUN echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >>/etc/sudoers
# Make sure kvm group exists. This is a no-op when it does.
RUN addgroup --system kvm
RUN usermod -a -G kvm runner
USER runner
ENV USER=runner
WORKDIR ${RUNNER_HOME}
COPY --from=build-s390x-runner-binaries /opt/runner.tar.gz /opt/runner.tar.gz
RUN tar -xzf /opt/runner.tar.gz -C ${RUNNER_HOME}
USER root
ENTRYPOINT ["/entrypoint.sh"]
CMD ["./bin/Runner.Listener", "run", "--startuptype", "service"]