FROM debian:bookworm-slim

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        inetutils-telnetd \
        xinetd \
    && rm -rf /var/lib/apt/lists/*

COPY xinetd-telnet.conf /etc/xinetd.d/telnet

# Create a test user for login verification (password: test)
RUN useradd -m -s /bin/bash testuser && \
    echo "testuser:test" | chpasswd

EXPOSE 23

CMD ["xinetd", "-dontfork", "-stayalive"]
