Ursache des 404 bei Zugriff über IP/Proxy: .NET-HttpListener bedient den Prefix http://localhost:8077/ nur bei Host: localhost. socat (L4) reicht den originalen Host-Header durch -> 404. Jetzt sitzt ein winziger nginx im Container davor, der den Host-Header auf localhost umschreibt (Upstream [::1]:8077, IPv4 als Fallback). App-Code bleibt unverändert. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
38 lines
1.5 KiB
Docker
38 lines
1.5 KiB
Docker
# Intune Manager - Test-Image (self-hosted).
|
|
# WICHTIG: Der bestehende App-/Client-Teil wird NICHT veraendert - Start.ps1, src/
|
|
# und www/ werden nur unveraendert ins Image kopiert. Die einzigen Container-
|
|
# Spezifika (Bridge fuer den localhost-Listener, Datenpfad, Login) laufen ueber
|
|
# Env-Variablen bzw. das Entrypoint-Script - ohne Codeaenderung.
|
|
FROM mcr.microsoft.com/powershell:7.4-debian-12
|
|
|
|
# nginx = interner Reverse-Proxy, der den Host-Header auf "localhost" umschreibt
|
|
# (HttpListener-Prefix http://localhost:8077/ bedient nur Host: localhost).
|
|
# git = fuer das optionale Policy-Git-Snapshot-Feature.
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends nginx git ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& pwsh -NoProfile -Command "Install-Module Microsoft.Graph.Authentication -Scope AllUsers -Force"
|
|
|
|
WORKDIR /app
|
|
|
|
# Bestehende App unveraendert ins Image kopieren (Build-Kontext = Repo-Root).
|
|
COPY Start.ps1 ./
|
|
COPY src/ ./src/
|
|
COPY www/ ./www/
|
|
|
|
# Interner nginx-Reverse-Proxy (Host-Rewrite) + Entrypoint (neu, nur fuer Container).
|
|
COPY docker/nginx.conf /etc/nginx/nginx.conf
|
|
COPY docker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
|
|
|
# Datenverzeichnis: Get-AppDataDir nutzt auf Linux $XDG_CONFIG_HOME ->
|
|
# Settings/Policy-Exporte landen im Volume /data. Kein Codeeingriff noetig.
|
|
ENV XDG_CONFIG_HOME=/data \
|
|
APP_PORT=8077 \
|
|
BRIDGE_PORT=8080
|
|
|
|
VOLUME /data
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|