FROM oven/bun:latest@sha256:9114c058aeae42162ee16dd5084b95fe9473970bb6bcb5b232ab1630f0546895

RUN apt-get update && apt-get install -y \
    openssh-server \
    iptables \
    iproute2 \
    iputils-ping \
    net-tools \
    dnsutils \
    procps \
    curl \
    python3 \
    dnsmasq \
    && rm -rf /var/lib/apt/lists/*

RUN mkdir -p /run/sshd && \
    sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config && \
    sed -i 's/#PubkeyAuthentication.*/PubkeyAuthentication yes/' /etc/ssh/sshd_config

# Trust the E2E forward proxy CA (for transparent HTTPS interception)
COPY config/proxy/squid-ca.crt /usr/local/share/ca-certificates/e2e-proxy-ca.crt
RUN update-ca-certificates

COPY simulators/greenwave/ /simulator/
COPY config/dhcp/dnsmasq.conf /etc/dnsmasq.d/e2e.conf
COPY config/routing/fw-isp-routes.sh /startup.sh
RUN chmod +x /startup.sh

CMD ["/startup.sh"]
