FROM debian:trixie-slim
WORKDIR /app/
RUN apt-get update                              && \
    apt-get install -qy --no-install-recommends    \
        qemu-system-x86=1:*                        \
        socat=1.*                               && \
    apt-get clean                               && \
    rm -rf /var/lib/apt/lists/
COPY --chmod=400 --chown=root:root ./bzImage               ./
COPY --chmod=400 --chown=root:root ./rootfs_pivot.ext2     ./
COPY --chmod=400 --chown=root:root ./rootfs_challenge.ext2 ./
COPY --chmod=500 --chown=root:root ./entrypoint.sh         ./
CMD ["socat", "TCP-LISTEN:4000,fork,reuseaddr", "exec:'/usr/bin/timeout -k 300 301 /app/entrypoint.sh'"]
