FROM debian:13

ENV DEBIAN_FRONTEND=noninteractive

RUN apt update
RUN apt install -y \
         git debhelper g++ make cmake libspandsp-dev flite1-dev \
         libspeex-dev libgsm1-dev libopus-dev libssl-dev python3-dev \
         python3-pip libev-dev \
         openssl libev-dev libmysqlcppconn-dev libevent-dev \
         libxml2-dev libcurl4-openssl-dev libhiredis-dev

RUN apt install -y devscripts libbcg729-dev \
         libsamplerate-dev libmp3lame-dev libcodec2-dev \
         cargo rustc
RUN pip install sip --break-system-packages
COPY . /sems
WORKDIR /sems

RUN mkdir -p build && cd build && cmake .. && make sems_tests && ./core/sems_tests
RUN mv pkg/deb/trixie ./debian
RUN dch -b -v $(cat VERSION) "sems"
RUN dpkg-buildpackage -rfakeroot -us -uc
RUN ls -al ..

RUN dpkg -i ../sems_*.deb
RUN /usr/sbin/sems -v

# Run SEMS with the specified configuration
CMD ["/usr/sbin/sems", "-E", "-f", "/etc/sems/sems.conf"]