Add TTY menu, Web UI, split Dockerfiles (host + ansible)

This commit is contained in:
2026-07-07 17:13:49 +00:00
parent a83919702f
commit 6de6bd0cbd
+34 -6
View File
@@ -39,7 +39,8 @@ RUN apk add --no-cache \
sudo \ sudo \
curl \ curl \
ca-certificates \ ca-certificates \
util-linux util-linux \
python3
# ── OpenRC: enable just what's needed ────────────────────── # ── OpenRC: enable just what's needed ──────────────────────
RUN rc-update add devfs sysinit && \ RUN rc-update add devfs sysinit && \
@@ -55,10 +56,36 @@ RUN rc-update add devfs sysinit && \
rc-update add dhcpcd default && \ rc-update add dhcpcd default && \
rc-update add docker default rc-update add docker default
# ── Serial console for QEMU -nographic ───────────────────── # ── TTY menu: auto-launch on serial console ────────────────
RUN echo 'ttyS0::respawn:/sbin/agetty -L 115200 ttyS0 xterm-256color' \ # 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 >> /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 ────────────────────────────────────────────── # ── Hostname ──────────────────────────────────────────────
RUN echo 'alpine-docker' > /etc/hostname RUN echo 'alpine-docker' > /etc/hostname
@@ -94,9 +121,10 @@ RUN printf '\n\
\e[1;34m╔════════════════════════════════════════════════╗\e[0m\n\ \e[1;34m╔════════════════════════════════════════════════╗\e[0m\n\
\e[1;34m║ Alpine Docker Host — QEMU pc-q35-10.0 ║\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╠════════════════════════════════════════════════╣\e[0m\n\
\e[1;34m║ docker run ansible-node IEC 62443 tests ║\e[0m\n\ \e[1;34m║ TTY: This console (auto-menu) ║\e[0m\n\
\e[1;34m║ SSH: ssh ansible@{ip} -p 22 ║\e[0m\n\ \e[1;34m║ Web UI: http://<ip>:8080 ║\e[0m\n\
\e[1;34m║ Pass: ansible ║\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╚════════════════════════════════════════════════╝\e[0m\n\ \e[1;34m╚════════════════════════════════════════════════╝\e[0m\n\
' > /etc/motd ' > /etc/motd