|
| 1 | +# Use AlmaLinux 8, a 1:1 RHEL 8 compatible OS with standard repositories |
| 2 | +FROM almalinux:8 |
| 3 | + |
| 4 | +# Set an environment variable to run dnf without prompts |
| 5 | +ENV DNF_ASSUMEYES=1 |
| 6 | + |
| 7 | +# Install build dependencies for CPython |
| 8 | +RUN dnf update -y && \ |
| 9 | + # --- FIX STARTS HERE --- |
| 10 | + # Install the DNF plugins package which provides the 'config-manager' command |
| 11 | + dnf install -y dnf-plugins-core && \ |
| 12 | + # --- FIX ENDS HERE --- |
| 13 | + # Enable the 'powertools' repository, which is the AlmaLinux equivalent of CRB |
| 14 | + dnf config-manager --set-enabled powertools && \ |
| 15 | + # Now, install all the packages |
| 16 | + dnf install -y \ |
| 17 | + gcc \ |
| 18 | + make \ |
| 19 | + git \ |
| 20 | + findutils \ |
| 21 | + zlib-devel \ |
| 22 | + bzip2-devel \ |
| 23 | + libffi-devel \ |
| 24 | + openssl-devel \ |
| 25 | + readline-devel \ |
| 26 | + sqlite-devel \ |
| 27 | + xz-devel \ |
| 28 | + tk-devel && \ |
| 29 | + # Clean up dnf cache to reduce image size |
| 30 | + dnf clean all |
| 31 | + |
| 32 | +# Create a non-root user to run the build |
| 33 | +RUN useradd --create-home buildbot |
| 34 | +USER buildbot |
| 35 | +WORKDIR /home/buildbot |
| 36 | + |
| 37 | +# Clone the CPython repository from GitHub |
| 38 | +# We use the 'main' branch, which is what the '3.x' buildbots track. |
| 39 | +# --depth 1 creates a shallow clone to save time and space. |
| 40 | +RUN git clone --branch main --depth 1 https://github.com/python/cpython.git |
| 41 | + |
| 42 | +# Set the working directory for the build |
| 43 | +WORKDIR /home/buildbot/cpython |
| 44 | + |
| 45 | +# Configure and build in a single layer |
| 46 | +# - Uses the exact configure flags from the buildbot: --with-pydebug and --with-lto |
| 47 | +# - make -j$(nproc) builds in parallel using all available CPU cores |
| 48 | +RUN ./configure --with-pydebug --with-lto && \ |
| 49 | + make -j$(nproc) |
| 50 | + |
| 51 | +# Set the environment variable to unlock the failure mode. |
| 52 | +ENV GITHUB_ACTION=fake |
| 53 | + |
| 54 | +CMD ["make", "test"] |
0 commit comments