# Baut die Windows-.exe des Host-Agents AUF LINUX — via Wine + Windows-Python + # PyInstaller. tobix/pywine bringt Wine + Windows-Python 3.11 mit (PyInstaller # kann NICHT cross-compilen, deshalb der Wine-Umweg). # # Zusaetzlich baut NSIS ein setup.exe, das die Agent-.exe installiert, eine .env # in C:\ProgramData\ARIA-Host-Agent anlegt (falls keine da ist) und den Agent als # automatisch startenden Windows-Dienst (via nssm) einrichtet. FROM tobix/pywine:3.11 ARG VERSION=0.0.0 # NSIS (Installer-Compiler, laeuft nativ auf Linux) + Tools fuer nssm. RUN apt-get update \ && apt-get install -y --no-install-recommends nsis curl unzip ca-certificates \ && rm -rf /var/lib/apt/lists/* WORKDIR /work # nssm — Non-Sucking Service Manager (public domain): macht aus der Konsolen-.exe # einen sauberen Windows-Dienst (die .exe selbst spricht das SCM nicht). # nssm.cc faellt oefter aus (503) — dann Ersatz aus dem Internet Archive. # Beide liefern dieselbe Datei; die Pruefsumme stellt das sicher. ARG NSSM_SHA256=727d1e42275c605e0f04aba98095c38a8e1e46def453cdffce42869428aa6743 RUN for url in https://nssm.cc/release/nssm-2.24.zip \ "https://web.archive.org/web/2024id_/https://nssm.cc/release/nssm-2.24.zip"; do \ curl -fsSL --retry 3 --retry-delay 5 --retry-all-errors "$url" -o /tmp/nssm.zip \ && echo "$NSSM_SHA256 /tmp/nssm.zip" | sha256sum -c - && break; \ echo "nssm: $url fehlgeschlagen, versuche naechste Quelle" >&2; rm -f /tmp/nssm.zip; \ done \ && test -f /tmp/nssm.zip \ && unzip -q /tmp/nssm.zip -d /tmp \ && cp /tmp/nssm-2.24/win64/nssm.exe ./nssm.exe \ && rm -rf /tmp/nssm* COPY requirements.txt host_agent.py ./ COPY windows/installer.nsi ./ # Windows-Python-Deps + PyInstaller, dann die Onefile-.exe bauen. RUN wine pip install --no-cache-dir -r requirements.txt pyinstaller RUN wine pyinstaller --onefile --name aria-host-agent --collect-all psutil host_agent.py \ && cp dist/aria-host-agent.exe ./aria-host-agent.exe \ && makensis -DVERSION=${VERSION} installer.nsi # Beide Artefakte rausreichen (dist/ wird vom build-win.sh als Volume gemountet). CMD ["bash","-lc","cp dist/aria-host-agent.exe /out/ && cp aria-host-agent-setup.exe /out/ && echo 'OK -> /out/aria-host-agent.exe + /out/aria-host-agent-setup.exe'"]