|
1 | | -# Self-Hosted IBM Z Github Actions Runner. |
2 | | - |
3 | | -# Temporary image: amd64 dependencies. |
| 1 | +# Stage 1: Temporary image for amd64 dependencies |
4 | 2 | FROM docker.io/amd64/ubuntu:22.04 as ld-prefix |
5 | 3 | ENV DEBIAN_FRONTEND=noninteractive |
6 | | -RUN apt-get update && apt-get -y install ca-certificates libicu70 libssl3 |
| 4 | +RUN apt-get update && apt-get -y install \ |
| 5 | + ca-certificates \ |
| 6 | + libicu70 \ |
| 7 | + libssl3 |
7 | 8 |
|
8 | | -# Main image. |
| 9 | +# Main image: ppc64le Ubuntu |
9 | 10 | FROM --platform=linux/ppc64le ubuntu:22.04 |
10 | 11 |
|
11 | | -# Packages for pytorch building and testing. |
| 12 | +# Set non-interactive mode for apt |
12 | 13 | ENV DEBIAN_FRONTEND=noninteractive |
13 | | -RUN apt-get update && apt-get -y install \ |
14 | | - cmake \ |
15 | | - curl \ |
16 | | - gcc \ |
17 | | - git \ |
18 | | - jq \ |
19 | | - zip \ |
20 | | - libxml2-dev \ |
21 | | - libxslt-dev \ |
22 | | - ninja-build \ |
23 | | - python-is-python3 \ |
24 | | - python3 \ |
25 | | - python3-dev \ |
26 | | - python3-pip \ |
27 | | - pybind11-dev \ |
28 | | - python3-numpy \ |
29 | | - libopenblas-dev \ |
30 | | - liblapack-dev \ |
31 | | - libgloo-dev \ |
32 | | - python3-yaml \ |
33 | | - python3-scipy \ |
34 | | - virtualenv |
35 | 14 |
|
36 | | -# amd64 dependencies. |
| 15 | +# Install dependencies for building and testing PyTorch |
| 16 | +RUN apt-get update && apt-get -y install --no-install-recommends \ |
| 17 | + build-essential \ |
| 18 | + cmake \ |
| 19 | + curl \ |
| 20 | + gcc \ |
| 21 | + git \ |
| 22 | + jq \ |
| 23 | + zip \ |
| 24 | + libxml2-dev \ |
| 25 | + libxslt-dev \ |
| 26 | + ninja-build \ |
| 27 | + python-is-python3 \ |
| 28 | + python3 \ |
| 29 | + python3-dev \ |
| 30 | + python3-pip \ |
| 31 | + pybind11-dev \ |
| 32 | + python3-numpy \ |
| 33 | + libopenblas-dev \ |
| 34 | + liblapack-dev \ |
| 35 | + libgloo-dev \ |
| 36 | + python3-yaml \ |
| 37 | + python3-scipy \ |
| 38 | + virtualenv \ |
| 39 | + wget \ |
| 40 | + ca-certificates \ |
| 41 | + && apt-get clean && rm -rf /var/lib/apt/lists/* |
| 42 | + |
| 43 | +# Copy amd64 dependencies from the ld-prefix stage |
37 | 44 | COPY --from=ld-prefix / /usr/x86_64-linux-gnu/ |
38 | 45 | RUN ln -fs ../lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 /usr/x86_64-linux-gnu/lib64/ |
39 | 46 | RUN ln -fs /etc/resolv.conf /usr/x86_64-linux-gnu/etc/ |
40 | 47 | ENV QEMU_LD_PREFIX=/usr/x86_64-linux-gnu |
41 | 48 |
|
42 | | -# Scripts. |
| 49 | +# Copy custom scripts |
43 | 50 | COPY fs/ / |
44 | | - |
45 | 51 | RUN chmod +x /usr/bin/actions-runner /usr/bin/entrypoint |
46 | 52 |
|
47 | | - |
48 | | -RUN curl -LO https://golang.org/dl/go1.21.1.linux-ppc64le.tar.gz && \ |
49 | | -tar -C /usr/local -xzf go1.21.1.linux-ppc64le.tar.gz && \ |
50 | | -export PATH=$PATH:/usr/local/go/bin &&\ |
51 | | -go version |
52 | | - |
53 | | -# install podman |
54 | | -# Add Podman repository and install Podman |
55 | | - |
56 | | -# Clone and build Podman |
| 53 | +# Install Go (v1.21.1) for ppc64le |
| 54 | +RUN curl -LO https://golang.org/dl/go1.21.1.linux-ppc64le.tar.gz && \ |
| 55 | + tar -C /usr/local -xzf go1.21.1.linux-ppc64le.tar.gz && \ |
| 56 | + rm go1.21.1.linux-ppc64le.tar.gz |
| 57 | +ENV PATH=$PATH:/usr/local/go/bin |
| 58 | +RUN go version |
| 59 | + |
| 60 | +# Install Podman (v4.6.0) for container management |
| 61 | +RUN apt-get update && apt-get install -y \ |
| 62 | + make \ |
| 63 | + gcc \ |
| 64 | + libseccomp-dev \ |
| 65 | + libapparmor-dev \ |
| 66 | + && apt-get clean && rm -rf /var/lib/apt/lists/* |
57 | 67 | RUN git clone https://github.com/containers/podman.git && \ |
58 | 68 | cd podman && \ |
59 | | - git checkout v4.6.0 && \ |
| 69 | + git checkout v4.6.0 && \ |
60 | 70 | make BUILDTAGS="seccomp apparmor" && \ |
61 | | - make install |
62 | | - |
63 | | - |
64 | | - |
65 | | - |
| 71 | + make install && \ |
| 72 | + cd .. && rm -rf podman |
66 | 73 |
|
67 | | -# amd64 Github Actions Runner. |
| 74 | +# Configure GitHub Actions Runner for amd64 |
68 | 75 | RUN useradd -m actions-runner |
69 | 76 | USER actions-runner |
70 | 77 | WORKDIR /home/actions-runner |
71 | 78 |
|
72 | | -# set up python virtual environment which is later used by runner. |
73 | | -# build workflows use "python -m pip install ...", |
74 | | -# and it doesn't work for non-root user |
| 79 | +# Set up Python virtual environment |
75 | 80 | RUN virtualenv --system-site-packages venv |
76 | 81 |
|
77 | | -# copy prebuilt manywheel docker image for builds and tests |
78 | | -# build command is: |
79 | | -# GPU_ARCH_TYPE=cpu-s390x "$(pwd)/manywheel/build_docker.sh" |
80 | | -# and save command is: |
81 | | -# docker image save -o manywheel-s390x.tar pytorch/manylinuxs390x-builder:cpu-s390x |
82 | | -# |
| 82 | +# Copy prebuilt manywheel docker image for builds and tests |
83 | 83 | COPY --chown=actions-runner:actions-runner manywheel-ppc64le.tar /home/actions-runner/manywheel-ppc64le.tar |
84 | 84 |
|
| 85 | +# Download and extract GitHub Actions Runner |
85 | 86 | RUN curl -L https://github.com/actions/runner/releases/download/v2.317.0/actions-runner-linux-x64-2.317.0.tar.gz | tar -xz |
86 | 87 |
|
| 88 | +# Entry point and default command |
87 | 89 | ENTRYPOINT ["/usr/bin/entrypoint"] |
88 | 90 | CMD ["/usr/bin/actions-runner"] |
0 commit comments