# Base image for cmpt 745 projects
FROM ubuntu:plucky AS build

RUN apt-get update \
    \
    && `# Start with all normal ubuntu packages` \
    && DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends apt-utils \
         ca-certificates \
         software-properties-common \
         lsb-release \
         gnupg2 \
         wget \
         git \
         make \
         ninja-build \
         cmake \
         valgrind \
         heaptrack \
         cppcheck \
         zlib1g-dev \
         googletest \
         libfmt-dev \
         libzstd-dev \
         python3 \
         python3-pip \
         libbpf-dev \
         python3-virtualenv \
         linux-tools-common \
         linux-tools-generic \
         libbpfcc-dev \
         libbenchmark-dev \
         gcc-15 \
         g++-15 \
         gdb \
         openjdk-21-jdk \
         maven \
         llvm-20 \
         clang-20 \
         lldb-20 \
         python3-clang-20 \
         llvm-20-dev \
         libclang-20-dev \
         liblldb-20-dev \
         clang-tidy-20 \
         clang-format-20 \
         clang-tools-20 \
         valgrind \
    \
    && `# Configure the latest version of GCC as the default` \
    && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-15 1000 \
    && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-15 1000 \
    \
    && `# Configure the latest version of LLVM as the default` \
    && update-alternatives --install /usr/bin/clang clang /usr/bin/clang-20 1000 \
    && update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-20 1000 \
    && update-alternatives --install /usr/bin/llvm-profdata llvm-profdata /usr/bin/llvm-profdata-20 1000 \
    && update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-20 1000 \
    && update-alternatives --install /usr/bin/opt opt /usr/bin/opt-20 1000 \
    \
    && `# Final apt cleanup` \
    && rm -rf /var/lib/apt/lists/* \
    \
    && virtualenv --python=python3 /opt/env745 \
    && . /opt/env745/bin/activate \
    && pip install angr frida-tools clang==20.1.0

ENV PATH="/opt/env745/bin:$PATH"
