# felhom-samba — the LAN SMB-sharing infra image for felhom-controller (R-7 slice 1).
#
# DUMB BY DESIGN: /etc/samba/smb.conf is bind-mounted READ-ONLY by the controller, which
# owns all rendering. This image templates nothing and bakes NO share name and NO password.
# The three-daemon discovery stack is the spike verdict
# (felhom.eu/documentation/audits/SPIKE-lan-discovery-2026-07-18.md, S4/S4b):
#   - smbd  : the SMB/CIFS server (445)
#   - nmbd  : NetBIOS name service — REQUIRED alongside wsdd. wsdd-only makes the box visible
#             in Explorer but the double-click fails 0x80070035 (no flat-name resolution);
#             nmbd is what makes \\<NAME> resolve + mount (S4b, proven live).
#   - wsdd  : WS-Discovery, so the box appears in Windows Explorer's Network view.
FROM alpine:3.21@sha256:48b0309ca019d89d40f670aa1bc06e426dc0931948452e8491e3d65087abc07d

# samba = smbd + nmbd + smbpasswd/testparm (meta-package proven installable in the spike);
# wsdd = WS-Discovery daemon; tini = a proper PID1 to reap nmbd/wsdd and forward signals.
RUN apk add --no-cache samba wsdd tini \
    && rm -rf /var/cache/apk/* \
    && rm -f /etc/samba/smb.conf

# passdb on a named volume → the household SMB password survives container recreation
# (share add/remove re-renders + `compose up -d`, which recreates the container).
VOLUME ["/var/lib/samba"]

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/sbin/tini", "--", "/entrypoint.sh"]
