# Native Linux C++ build/test environment for the Void research projects.
#
# This is the lean native image: GCC 16 (C++26 reflection), CMake 4, Ninja and
# the Void dependencies, without the Vulkan/GPU stack (use the `vulkan` image
# for that) and without Wine (use a Windows image for that).
#
# Arch Linux is the base because it packages GCC 16, CMake 4 and every Void
# dependency in one repository. The install is split into several RUN layers
# so no single image layer gets large enough to upset the container registry.
FROM archlinux:base-devel

LABEL org.opencontainers.image.title="Void CI Linux native" \
      org.opencontainers.image.description="GCC 16, CMake 4, Ninja and the Void C++ dependencies on Arch Linux" \
      org.opencontainers.image.source="https://git.faumaray.com/Void/CI-Images"

ENV LANG=C.UTF-8 \
    LC_ALL=C.UTF-8 \
    CMAKE_GENERATOR=Ninja \
    CCACHE_DIR=/var/cache/ccache

RUN pacman -Syu --noconfirm \
    && pacman -S --noconfirm --needed \
        base-devel gcc cmake ninja git pkgconf python ccache \
    && pacman -Scc --noconfirm

RUN pacman -S --noconfirm --needed \
        boost openssl sqlite gtest glfw freetype2 libsodium libarchive \
    && pacman -Scc --noconfirm

RUN pacman -S --noconfirm --needed \
        libx11 libxcb libxcursor libxrandr libxi libxinerama libxkbcommon \
        wayland wayland-protocols xorg-server-xvfb \
        zip unzip jq curl ca-certificates \
    && pacman -Scc --noconfirm

RUN pacman -S --noconfirm --needed \
        nodejs npm \
    && pacman -Scc --noconfirm

RUN git config --system --add safe.directory '*' \
    && useradd --create-home --shell /bin/bash builder \
    && mkdir -p /var/cache/ccache \
    && chown builder:builder /var/cache/ccache

USER builder
WORKDIR /home/builder

CMD ["/bin/bash"]
