###############################################################################
# Dockerfile used to make gitlab.linphone.org:4567/bc/public/flexisip/bc-dev-ubuntu-26-04:20260430_add_squid_proxy
###############################################################################

FROM ubuntu:26.04
RUN userdel -r ubuntu

LABEL org.opencontainers.image.authors="Belledonne Communications <flexisip@belledonne-communications.com>"

# Update
RUN apt-get -y update \
 && apt-get -y install \
    # Install common tools
      sudo \
      vim \
      wget \
      file \
      curl \
    # Install development tools
      ccache \
      clang \
      cmake \
      doxygen \
      g++ \
      gdb \
      git \
      make \
      ninja-build \
      python3 \
      python3-pystache \
      python3-six \
      yasm \
    # Install all dependencies needed for Flexisip
      libsystemd-dev \
      libssl-dev \
      libboost-dev \
      libboost-system-dev \
      libboost-thread-dev \
      libcpp-jwt-dev \
      libhiredis-dev \
      libjsoncpp-dev \
      libnghttp2-dev \
      libsqlite3-dev \
      libpq-dev \
      libmariadb-dev \
      libmariadb-dev-compat \
      libsnmp-dev \
      libxerces-c-dev \
      libsrtp2-dev \
      libgsm1-dev \
      libopus-dev \
      libmbedtls-dev \
      libspeex-dev \
      libspeexdsp-dev \
      libxml2-dev \
      redis-server \
    # Dependencies of the B2BUA
      libvpx-dev \
    # Dependencies of the tester
      mariadb-server \
      squid \
    # Dependencies of CPack (to build the .deb)
      dpkg-dev \
  # Clean up
 && apt-get -y autoremove \
 && apt-get -y clean

# Configure user 'bc'
RUN useradd -ms /bin/bash bc && \
    echo 'bc:cotcot' | chpasswd && \
    echo 'bc ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

# Switch to user 'bc'
USER bc
WORKDIR /home/bc

# CVE-2022-24765, from git 2.35.2 onward
RUN git config --global --add safe.directory *


# Example build commands
#
# cd flexisip/
# export CC=gcc
# export CXX=g++
# export BUILD_DIR_NAME="build.ubuntu26"
# cmake -S . -B ./$BUILD_DIR_NAME -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="$PWD/$BUILD_DIR_NAME/install" -DENABLE_UNIT_TESTS=ON
# cd $BUILD_DIR_NAME
# cmake --build . --target install
# LSAN_OPTIONS="suppressions=../sanitizer_ignore.txt" bin/flexisip_tester --resource-dir "../tester/"
