FROM debian:bullseye-slim

RUN apt-get update && apt-get install --yes \
    net-tools \
    netbase \
    netcat \
    supervisor \
    && rm -rf /var/lib/apt/lists/*

COPY ixagent-*.deb /tmp/.

# See https://support.ixon.cloud/hc/en-us/articles/360018804640-Debian-IXagent.
RUN dpkg --install /tmp/ixagent-*.deb; exit 0
RUN apt-get update && apt-get install --yes --fix-broken --fix-missing && rm -rf /var/lib/apt/lists/*

# Expose Plain-text TCP port.
EXPOSE 9230/tcp

# Copy files.
COPY ./etc/supervisor/supervisor.conf /etc/supervisor/supervisor.conf
COPY ./entrypoint.sh /usr/bin/entrypoint.sh

# Setup container and start services.
ENTRYPOINT [ "/usr/bin/entrypoint.sh" ]
