## Image to build from sources

FROM python:3.11-bookworm
MAINTAINER XiVO Team "dev+docker@proformatique.com"

# Install xivo-confd
ADD . /usr/src/xivo-confd
RUN mkdir /etc/xivo
COPY integration_tests/assets/wizard/default_french_configuration.sql /etc/xivo/
WORKDIR /usr/src/xivo-confd

ENV PYTHONDONTWRITEBYTECODE=1

RUN pip install --upgrade "pip < 21.0"
RUN pip install -r requirements.txt
RUN python setup.py install

# Configure environment
RUN touch /var/log/xivo-confd.log
RUN mkdir /etc/xivo-confd/
RUN cp /usr/src/xivo-confd/etc/xivo-confd/*.yml /etc/xivo-confd/
RUN mkdir /etc/xivo-confd/conf.d
RUN mkdir /var/run/xivo-confd
RUN mkdir /etc/xivo/wizard.d
RUN chown www-data /var/run/xivo-confd

EXPOSE 9486

CMD ["xivo-confd", "-fd"]
