ARG BUILD_FROM FROM $BUILD_FROM # Install system dependencies RUN apk add --no-cache \ samba \ samba-common-tools \ python3 \ py3-pip \ util-linux \ blkid \ e2fsprogs \ psmisc \ lsof \ file \ ntfs-3g \ ntfs-3g-progs \ exfatprogs \ dosfstools \ parted \ bash \ curl \ jq \ avahi \ avahi-tools \ dbus \ rsync \ smartmontools # hd-idle for optional HDD spindown (hdd_idle_seconds). # Kept in a separate, NON-FATAL step so the add-on still builds even if the # package is missing in the base image's repositories. The runtime checks # `command -v hd-idle` and simply disables the feature if it's absent. RUN apk add --no-cache hd-idle \ || apk add --no-cache hd-idle --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community \ || echo "WARNING: hd-idle unavailable in repos — HDD spindown will be disabled at runtime" # restic + rclone for external backups (Hetzner, S3, B2, SFTP, WebDAV, ...). # Non-fatal like hd-idle: without them the add-on still works, the Backup tab # then says which tool is missing. RUN apk add --no-cache restic rclone \ || echo "WARNING: restic/rclone unavailable - external backups will be disabled at runtime" # Install Python packages RUN pip3 install --break-system-packages flask psutil waitress # WebDAV (webdav_enabled): WsgiDAV ohne seine Abhaengigkeiten passlib/bcrypt - die braucht nur seine # htpasswd-Anmeldung, Simple NAS meldet gegen die Samba-Benutzer an. Jinja2 kommt mit Flask. RUN pip3 install --break-system-packages --no-deps wsgidav==4.3.5 defusedxml==0.7.1 json5==0.17.3 # FTP (ftp_enabled) fuer Geraete, die nur FTP koennen; asyncore/asynchat fehlen seit Python 3.12 RUN pip3 install --break-system-packages --no-deps pyftpdlib==2.2.0 pyasyncore==1.0.5 pyasynchat==1.0.5 # Install wsdd (WS-Discovery for Windows 10+) directly from GitHub RUN curl -sSL https://raw.githubusercontent.com/christgau/wsdd/master/src/wsdd.py \ -o /usr/local/bin/wsdd && chmod +x /usr/local/bin/wsdd # Create required directories RUN mkdir -p /etc/samba /var/log/samba /var/run/samba /data/shares /data/mounts \ /var/run/dbus /var/run/avahi-daemon /etc/avahi/services # Copy avahi service definition (mDNS discovery for Linux & macOS) COPY smb.service /etc/avahi/services/smb.service # Avahi config: allow running in container without chroot # Do not restrict to a single interface so it works regardless of HA network setup RUN sed -i 's/#enable-dbus=yes/enable-dbus=yes/' /etc/avahi/avahi-daemon.conf 2>/dev/null || true # Copy application files and set permissions COPY app/ /app/ COPY run.sh /run.sh RUN chmod +x /run.sh /app/mount_helper.sh WORKDIR /app CMD ["/run.sh"]