From 6de6bd0cbd1bcb798ee79451119ef28a327ef3b5 Mon Sep 17 00:00:00 2001 From: oval Date: Tue, 7 Jul 2026 17:13:49 +0000 Subject: [PATCH] Add TTY menu, Web UI, split Dockerfiles (host + ansible) --- Dockerfile.alpine-host | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/Dockerfile.alpine-host b/Dockerfile.alpine-host index 9527455..5e7bcc0 100644 --- a/Dockerfile.alpine-host +++ b/Dockerfile.alpine-host @@ -39,7 +39,8 @@ RUN apk add --no-cache \ sudo \ curl \ ca-certificates \ - util-linux + util-linux \ + python3 # ── OpenRC: enable just what's needed ────────────────────── RUN rc-update add devfs sysinit && \ @@ -55,10 +56,36 @@ RUN rc-update add devfs sysinit && \ rc-update add dhcpcd default && \ rc-update add docker default -# ── Serial console for QEMU -nographic ───────────────────── -RUN echo 'ttyS0::respawn:/sbin/agetty -L 115200 ttyS0 xterm-256color' \ +# ── TTY menu: auto-launch on serial console ──────────────── +# Uses agetty -l to replace /bin/login with the menu script +COPY scripts/tty-menu.sh /usr/local/bin/tty-menu.sh +RUN chmod +x /usr/local/bin/tty-menu.sh && \ + echo 'ttyS0::respawn:/sbin/agetty -L 115200 ttyS0 xterm-256color -l /usr/local/bin/tty-menu.sh' \ >> /etc/inittab +# ── Web UI ──────────────────────────────────────────────── +COPY webui/app.py /usr/local/bin/webui.py +RUN chmod +x /usr/local/bin/webui.py + +# OpenRC service for the web UI +RUN printf '#!/sbin/openrc-run\n\ +name="webui"\n\ +description="IEC 62443-3-3 Web UI"\n\ +command="/usr/bin/python3"\n\ +command_args="/usr/local/bin/webui.py"\n\ +command_background=true\n\ +pidfile="/run/webui.pid"\n\ +depend() {\n\ + need net docker\n\ +}\n' \ + > /etc/init.d/webui && \ + chmod +x /etc/init.d/webui && \ + rc-update add webui default + +# ── Shared directories (host ↔ ansible container) ───────── +RUN mkdir -p /ansible/playbooks /ansible/reports /ansible/inventory && \ + chown -R ansible:ansible /ansible + # ── Hostname ────────────────────────────────────────────── RUN echo 'alpine-docker' > /etc/hostname @@ -94,9 +121,10 @@ RUN printf '\n\ \e[1;34m╔════════════════════════════════════════════════╗\e[0m\n\ \e[1;34m║ Alpine Docker Host — QEMU pc-q35-10.0 ║\e[0m\n\ \e[1;34m╠════════════════════════════════════════════════╣\e[0m\n\ -\e[1;34m║ docker run ansible-node → IEC 62443 tests ║\e[0m\n\ -\e[1;34m║ SSH: ssh ansible@{ip} -p 22 ║\e[0m\n\ -\e[1;34m║ Pass: ansible ║\e[0m\n\ +\e[1;34m║ TTY: This console (auto-menu) ║\e[0m\n\ +\e[1;34m║ Web UI: http://:8080 ║\e[0m\n\ +\e[1;34m║ SSH: ssh ansible@ -p 22 ║\e[0m\n\ +\e[1;34m║ Pass: ansible ║\e[0m\n\ \e[1;34m╚════════════════════════════════════════════════╝\e[0m\n\ ' > /etc/motd