FROM debian:stable

# Prevent interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive

# Install fish shell and other basic utilities as root during build
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        fish=4.0.2-1 \
        curl=8.14.1-2 \
        wget=1.25.0-2 \
        jq=1.7.1-6+deb13u1 \
        git=1:2.47.3-0+deb13u1 \
        openssh-client=1:10.0p1-7 \
        vim=2:9.1.1230-2 \
        netcat-openbsd=1.229-1 \
        ripgrep=14.1.1-1+b4 \
        fzf=0.60.3-1+b2 \
        unzip=6.0-29 \
        zip=3.0-15 \
        htop=3.4.1-5 \
        tree=2.2.1-1 \
        less=668-1 \
        rsync=3.4.1+ds1-5 \
        iputils-ping=3:20240905-3 \
        procps=2:4.0.4-9 \
        lsof=4.99.4+dfsg-2 \
        strace=6.13+ds-1 \
        tcpdump=4.99.5-2 \
        gnupg2=2.4.7-21 \
        gnupg-agent=2.4.7-21 \
        apt-transport-https=3.0.3 \
        lsb-release=12.1-1 \
        bind9-dnsutils=1:9.20.15-1~deb13u1 \
        ca-certificates=20250419 \
        docker.io=26.1.5+dfsg1-9+b9 \
        docker-cli=26.1.5+dfsg1-9+b9 \
        && \
    # Clean up package cache \
    rm -rf /var/lib/apt/lists/*

# Create the user during build process with specific UID/GID
RUN groupadd -r tsysdevstack && useradd -r -m -g tsysdevstack -s /usr/bin/fish tsysdevstack

# Add tsysdevstack user to the existing docker group
RUN usermod -aG docker tsysdevstack

# Set the fish shell as default for the user
RUN echo "if [ \"\$SHELL\" != \"/usr/bin/fish\" ]; then exec fish; fi" >> /home/tsysdevstack/.bashrc

# Change to the tsysdevstack user
USER tsysdevstack

# Set the home directory
WORKDIR /home/tsysdevstack

# Set default shell to fish
SHELL ["/usr/bin/fish"]

# Default command when container starts
CMD ["fish"]