# syntax=docker/dockerfile:1 # Debian build environment (latest stable, Debian 13 "trixie") producing a .deb # alongside the binary. Separate from Dockerfile (Ubuntu 26.04) because the # distro and its libc++/SDL3 versions differ, and a .deb's dependencies must be # generated against the distro it targets. # # Toolchain: clang-19 + libc++-19 (for `import std;`). Debian 13 ships CMake # 3.31, whose experimental `import std` gate value the project does not target, # so an upstream CMake is installed from the Kitware tarball. FROM debian:stable AS dev ENV DEBIAN_FRONTEND=noninteractive ARG APT_MIRROR="" RUN if [ -n "$APT_MIRROR" ]; then \ sed -i -e "s|http://deb.debian.org/debian|${APT_MIRROR}|g" \ -e "s|http://security.debian.org/debian-security|${APT_MIRROR}|g" \ /etc/apt/sources.list /etc/apt/sources.list.d/*.sources 2>/dev/null || true; \ fi RUN --mount=type=cache,target=/var/lib/apt,sharing=locked \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ for attempt in 1 2 3 4 5; do \ apt-get -o Acquire::Retries=5 update && break; \ echo "apt-get update failed (attempt $attempt), retrying"; \ sleep 5; \ done \ && apt-get -o Acquire::Retries=5 install -y --no-install-recommends \ ca-certificates \ clang-19 \ clang-tools-19 \ curl \ dpkg-dev \ file \ libc++-19-dev \ libc++abi-19-dev \ libsdl3-dev \ libunwind-19-dev \ lld-19 \ ninja-build \ pkg-config \ python3 \ && rm -rf /var/lib/apt/lists/* # Upstream CMake, because Debian 13's 3.31 experimental gate does not enable the # `import std;` support the project relies on. ARG CMAKE_VERSION=4.2.3 RUN mkdir -p /opt/cmake \ && curl -fL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz" \ | tar -xz -C /opt/cmake --strip-components=1 ENV PATH="/opt/cmake/bin:${PATH}" ENV CC=clang-19 ENV CXX=clang++-19 WORKDIR /work COPY . . RUN cmake -S . -B build/debian -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_STDLIB_MODULES_JSON=/usr/lib/llvm-19/lib/libc++.modules.json \ -DOPENRA3_DISTRO_TAG=debian13 \ && cmake --build build/debian -j \ && ctest --test-dir build/debian --output-on-failure \ && (cd build/debian && cpack -G DEB) # deploy target: runtime dependencies + final binary, minimal and fast. FROM debian:stable AS deploy ENV DEBIAN_FRONTEND=noninteractive RUN --mount=type=cache,target=/var/lib/apt,sharing=locked \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ apt-get -o Acquire::Retries=5 update \ && apt-get -o Acquire::Retries=5 install -y --no-install-recommends \ libc++1-19 \ libc++abi1-19 \ libsdl3-0 \ libvulkan1 \ && rm -rf /var/lib/apt/lists/* WORKDIR /app COPY --from=dev /work/build/debian/bin/openra3 /app/openra3 ENTRYPOINT ["/app/openra3"]