|
| 1 | +FROM almalinux:8 |
| 2 | + |
| 3 | +ARG VULKAN_SDK_VERSION=1.4.335.0 |
| 4 | +ARG GLFW_VERSION=3.4 |
| 5 | +ARG GLSLANG_VERSION=13.1.1 |
| 6 | + |
| 7 | +# GPU_TARGET and THEROCK_FAMILY are set at workflow runtime, not in the base image |
| 8 | +ENV VULKAN_SDK_VERSION=${VULKAN_SDK_VERSION} |
| 9 | + |
| 10 | +RUN dnf install -y dnf-plugins-core && \ |
| 11 | + dnf config-manager --set-enabled powertools && \ |
| 12 | + dnf update -y && \ |
| 13 | + dnf install -y \ |
| 14 | + unzip \ |
| 15 | + xz \ |
| 16 | + gcc \ |
| 17 | + gcc-c++ \ |
| 18 | + gcc-toolset-13-gcc-c++ \ |
| 19 | + gcc-toolset-13-libstdc++-devel \ |
| 20 | + make \ |
| 21 | + wget \ |
| 22 | + git \ |
| 23 | + curl \ |
| 24 | + nasm \ |
| 25 | + python3.11 \ |
| 26 | + python3.11-pip \ |
| 27 | + elfutils-devel \ |
| 28 | + mesa-libGL-devel \ |
| 29 | + wayland-devel \ |
| 30 | + libxkbcommon-devel \ |
| 31 | + libXcursor-devel \ |
| 32 | + libXi-devel \ |
| 33 | + libXinerama-devel \ |
| 34 | + libXrandr-devel \ |
| 35 | + libatomic && \ |
| 36 | + dnf clean all |
| 37 | + |
| 38 | +# GCC 8's libstdc++fs has an ABI-incompatible std::filesystem::path layout vs |
| 39 | +# the one expected by TheRock's libhsa-runtime64.so (built with a newer GCC). |
| 40 | +# GCC 13 from gcc-toolset-13 provides a compatible implementation. |
| 41 | +ENV PATH="/opt/rh/gcc-toolset-13/root/usr/bin:${PATH}" \ |
| 42 | + LD_LIBRARY_PATH="/opt/rh/gcc-toolset-13/root/usr/lib/gcc/x86_64-redhat-linux/13" |
| 43 | + |
| 44 | +# ============================================================================ |
| 45 | +# Python virtual environment (ready for ROCm wheel or tarball installation) |
| 46 | +# ROCm installation is delegated to the CI workflow to support both methods |
| 47 | +# ============================================================================ |
| 48 | + |
| 49 | +RUN python3.11 -m venv /opt/venv && \ |
| 50 | + /opt/venv/bin/pip install --upgrade pip && \ |
| 51 | + /opt/venv/bin/pip install pyyaml cmake |
| 52 | + |
| 53 | +ENV PATH="/opt/venv/bin:${PATH}" |
| 54 | +ENV VIRTUAL_ENV="/opt/venv" |
| 55 | + |
| 56 | +# Build GLFW from source (not available in RHEL 8 repos) |
| 57 | +WORKDIR /tmp |
| 58 | +RUN wget https://github.com/glfw/glfw/releases/download/${GLFW_VERSION}/glfw-${GLFW_VERSION}.zip && \ |
| 59 | + unzip glfw-${GLFW_VERSION}.zip && \ |
| 60 | + cmake -S glfw-${GLFW_VERSION} -B glfw-${GLFW_VERSION}/build \ |
| 61 | + -DGLFW_BUILD_EXAMPLES=OFF \ |
| 62 | + -DGLFW_BUILD_TESTS=OFF \ |
| 63 | + -DGLFW_BUILD_DOCS=OFF && \ |
| 64 | + cmake --build glfw-${GLFW_VERSION}/build --target install && \ |
| 65 | + rm -rf /tmp/glfw-${GLFW_VERSION}* |
| 66 | + |
| 67 | +# Build glslang from source (Vulkan SDK prebuilt binaries require glibc 2.34+, |
| 68 | +# but RHEL 8 ships glibc 2.28) |
| 69 | +RUN git clone --branch ${GLSLANG_VERSION} --depth 1 https://github.com/KhronosGroup/glslang.git && \ |
| 70 | + cmake -S glslang -B glslang/build \ |
| 71 | + -DCMAKE_BUILD_TYPE=Release \ |
| 72 | + -DENABLE_OPT=OFF \ |
| 73 | + -DENABLE_CTEST=OFF && \ |
| 74 | + cmake --build glslang/build -j$(nproc) --target glslang-standalone && \ |
| 75 | + cp glslang/build/StandAlone/glslang /usr/local/bin/glslangValidator && \ |
| 76 | + rm -rf /tmp/glslang |
| 77 | + |
| 78 | +# Install Vulkan SDK (headers, libraries, and layers) |
| 79 | +ENV VULKAN_SDK=/opt/vulkan-sdk/${VULKAN_SDK_VERSION}/x86_64 |
| 80 | +RUN mkdir -p /opt/vulkan-sdk && \ |
| 81 | + wget https://sdk.lunarg.com/sdk/download/${VULKAN_SDK_VERSION}/linux/vulkansdk-linux-x86_64-${VULKAN_SDK_VERSION}.tar.xz && \ |
| 82 | + tar -xvf vulkansdk-linux-x86_64-${VULKAN_SDK_VERSION}.tar.xz -C /opt/vulkan-sdk && \ |
| 83 | + rm vulkansdk-linux-x86_64-${VULKAN_SDK_VERSION}.tar.xz && \ |
| 84 | + cp /usr/local/bin/glslangValidator ${VULKAN_SDK}/bin/glslangValidator |
| 85 | + |
| 86 | +ENV PATH="${VULKAN_SDK}/bin:${PATH}" |
| 87 | +ENV LD_LIBRARY_PATH="${VULKAN_SDK}/lib:${LD_LIBRARY_PATH}" |
| 88 | +ENV VK_ADD_LAYER_PATH="${VULKAN_SDK}/share/vulkan/explicit_layer.d" |
| 89 | +ENV PKG_CONFIG_PATH="${VULKAN_SDK}/share/pkgconfig:${VULKAN_SDK}/lib/pkgconfig" |
| 90 | + |
| 91 | +# Build FFmpeg from source (not available in RHEL 8 repos) |
| 92 | +WORKDIR /tmp |
| 93 | +RUN wget https://ffmpeg.org/releases/ffmpeg-4.4.6.tar.xz && \ |
| 94 | + tar -xvf ffmpeg-4.4.6.tar.xz && \ |
| 95 | + cd ffmpeg-4.4.6 && \ |
| 96 | + ./configure --enable-pic --enable-shared && \ |
| 97 | + make -j$(nproc) && \ |
| 98 | + make install && \ |
| 99 | + ldconfig && \ |
| 100 | + rm -rf /tmp/ffmpeg-4.4.6* |
| 101 | + |
| 102 | +ENV HIP_PLATFORM=amd |
| 103 | + |
| 104 | +WORKDIR /workspace |
| 105 | + |
| 106 | +CMD ["/bin/bash"] |
0 commit comments