FROM docker.io/library/ubuntu:26.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
    apt-get install -y \
    cmake \
    curl \
    ninja-build \
    build-essential \
    mold \
    python3 \
    python3-dev \
    python-is-python3 \
    python3-argcomplete \
    python3-yaml \
    zlib1g-dev \
    flex \
    bison \
    libx11-dev \
    libxrandr-dev \
    libxcursor-dev \
    libxi-dev \
    libudev-dev \
    libgl-dev \
    libflac-dev \
    libogg-dev \
    libvorbis-dev \
    libpsl-dev \
    libidn2-dev \
    libldap2-dev \
    sccache \
    zip \
    unzip \
    wget \
    git \
    gh \
    ca-certificates \
    lsb-release \
    gnupg \
    software-properties-common && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN curl -fSL --retry 3 https://apt.llvm.org/llvm.sh -o /tmp/llvm.sh && \
    bash /tmp/llvm.sh 21 && \
    rm /tmp/llvm.sh && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

ENV CC=clang-21
ENV CXX=clang++-21
ENV LLVM_USE_LINKER=mold

# Create a new user with id 1001 as that is the user id that
# Github Actions uses to perform the checkout action.
RUN useradd gha -u 1001 -m -s /bin/bash
RUN usermod -aG sudo gha
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER gha
WORKDIR /home/gha
