FROM ubuntu:rolling

WORKDIR /tmp
ENV HOME=/tmp
RUN chmod -R 777 /tmp

# Install apt dependencies
RUN apt-get update
RUN apt-get upgrade -y
RUN TZ=America/Los_Angeles DEBIAN_FRONTEND=noninteractive apt-get install -y \
    build-essential \
    ccache \
    clang \
    cmake \
    curl \
    devscripts \
    gcovr \
    git \
    latexmk \
    libc6-dbg \
    llvm \
    mold \
    ninja-build \
    pre-commit \
    python3-requests \
    rpm \
    texlive-bibtex-extra \
    texlive-fonts-recommended \
    texlive-latex-extra \
    texlive-pictures \
    valgrind \
    wget \
    zstd

# MinIO client, for uploading build artifacts
RUN curl -Ls "https://dl.min.io/client/mc/release/linux-$(dpkg --print-architecture)/mc" \
    -o /usr/local/bin/mc && chmod +x /usr/local/bin/mc

ENV CC=clang
ENV CXX=clang++

# Try to have all the pre-commit hooks we'll need already initialized
COPY .pre-commit-config.yaml /tmp/
RUN git init && pre-commit install-hooks
