# Use Alpine Linux as the base image due to its small size and security focus
FROM alpine:3.19.1

# Install OpenSSH, network troubleshooting tools, and stress-ng
RUN apk update && \
    apk add --no-cache openssh net-tools iperf3 nmap curl tcpdump stress-ng && \
    rm -rf /var/cache/apk/*

# Set up a user with a password (replace 'user' and 'password' with your desired values)
RUN adduser -D user && \
    echo "user:password" | chpasswd

# Configure SSH (adjust settings as necessary)
RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config && \
    echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config && \
    mkdir -p /run/sshd

# Generate SSH host keys
RUN ssh-keygen -A

# Expose the SSH port
EXPOSE 22

# Run the SSH server along with an instruction to keep the container running
CMD ["/usr/sbin/sshd", "-D", "-e"]