# syntax=docker/dockerfile:1 # Linux on ARM64 cross-build environment (aarch64-linux-gnu), isolated from the # x86_64 Linux image and the Windows images. # # Toolchain: clang-21 + libc++ with the arm64 libc++ (for `import std;`), the # arm64 glibc from `gcc-aarch64-linux-gnu`, arm64 SDL3 from `libsdl3-dev:arm64`, # and lld as the linker. The arm64 packages are installed with dpkg multiarch # (`arm64` added to the sources); the native clang/cmake build tools stay amd64. FROM ubuntu:26.04 AS dev ENV DEBIAN_FRONTEND=noninteractive ARG APT_MIRROR="" RUN if [ -n "$APT_MIRROR" ]; then \ sed -i -e "s|http://archive.ubuntu.com/ubuntu|${APT_MIRROR}|g" \ -e "s|http://security.ubuntu.com/ubuntu|${APT_MIRROR}|g" \ -e "s|http://ports.ubuntu.com/ubuntu-ports|${APT_MIRROR}|g" \ /etc/apt/sources.list /etc/apt/sources.list.d/*.sources 2>/dev/null || true; \ fi # Enable the arm64 architecture on top of the emulated amd64 userland. RUN dpkg --add-architecture arm64 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-21 \ cmake \ dpkg-dev \ file \ gcc-aarch64-linux-gnu \ libc++-21-dev:arm64 \ libc++abi-21-dev:arm64 \ libsdl3-dev:arm64 \ libunwind-21-dev:arm64 \ lld-21 \ ninja-build \ pkg-config \ python3 \ && rm -rf /var/lib/apt/lists/* ENV CC=clang-21 ENV CXX=clang++-21 # Point pkg-config at the arm64 packages so SDL3 resolves to the aarch64 build. ENV PKG_CONFIG_LIBDIR=/usr/lib/aarch64-linux-gnu/pkgconfig WORKDIR /work COPY . . RUN cmake -S . -B build/linux-arm64 -G Ninja \ -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/clang-aarch64-linux-gnu.cmake \ -DCMAKE_BUILD_TYPE=Release \ -DOPENRA3_DISTRO_TAG=ubuntu26.04 \ && cmake --build build/linux-arm64 -j \ && (cd build/linux-arm64 && cpack -G DEB) # deploy target: runtime dependencies + final binary, minimal and fast. This is # an arm64 image; build it on (or with emulation for) an arm64 host. FROM --platform=linux/arm64 ubuntu:26.04 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 \ libc++abi1 \ libsdl3-0 \ libvulkan1 \ && rm -rf /var/lib/apt/lists/* WORKDIR /app COPY --from=dev /work/build/linux-arm64/bin/openra3 /app/openra3 ENTRYPOINT ["/app/openra3"]