# Development image for VoidLibrary.
#
# Toolchain: GCC 16 (C++26 reflection), CMake 4, Ninja.
# Optional dependencies used by the modules: Boost, OpenSSL, libsodium,
# libarchive, SQLite3 and Lua 5.4.
#
# The image does not copy or build the sources: mount the repository at /src
# (the devcontainer does this) and configure/build there.

FROM ubuntu:24.04

ARG DEBIAN_FRONTEND=noninteractive
ARG GCC_VERSION=16
ARG CMAKE_VERSION=4.2.3

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        build-essential \
        ca-certificates \
        curl \
        git \
        gnupg \
        ninja-build \
        pkg-config \
        software-properties-common \
        libboost-all-dev \
        libssl-dev \
        libsodium-dev \
        libarchive-dev \
        libsqlite3-dev \
        liblua5.4-dev \
        zlib1g-dev \
    && add-apt-repository -y ppa:ubuntu-toolchain-r/test \
    && apt-get update \
    && apt-get install -y --no-install-recommends \
        gcc-${GCC_VERSION} \
        g++-${GCC_VERSION} \
    && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} 100 \
    && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCC_VERSION} 100 \
    && rm -rf /var/lib/apt/lists/*

RUN curl -fsSL -o /tmp/cmake.tar.gz \
        "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz" \
    && tar -xzf /tmp/cmake.tar.gz -C /opt \
    && ln -s "/opt/cmake-${CMAKE_VERSION}-linux-x86_64/bin/cmake" /usr/local/bin/cmake \
    && ln -s "/opt/cmake-${CMAKE_VERSION}-linux-x86_64/bin/ctest" /usr/local/bin/ctest \
    && ln -s "/opt/cmake-${CMAKE_VERSION}-linux-x86_64/bin/cpack" /usr/local/bin/cpack \
    && rm /tmp/cmake.tar.gz

WORKDIR /src

CMD ["bash"]
