Files
watcher/Dockerfile
2025-08-22 09:20:31 +02:00

33 lines
877 B
Docker

# 1. Build-Phase: SDK-Image
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /app
# Projektdateien kopieren und Abhängigkeiten wiederherstellen
COPY *.sln .
COPY Watcher/*.csproj ./Watcher/
RUN dotnet restore
# Restliche Dateien kopieren und Build ausführen
COPY Watcher/. ./Watcher/
WORKDIR /app/Watcher
RUN dotnet publish -c Release -o /app/publish /p:UseAppHost=false
# 2. Laufzeit-Phase: ASP.NET Core Runtime
FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY --from=build /app/publish .
# Stelle sicher, dass Verzeichnisse existieren
RUN mkdir -p /app/persistence /app/wwwroot/downloads/sqlite /app/logs
# Volumes
VOLUME ["/app/persistence", "/app/wwwroot/downloads/sqlite", "/app/logs"]
# Expose Port 5000
EXPOSE 5000
ENV ASPNETCORE_URLS=http://*:5000
ENV ASPNETCORE_ENVIRONMENT=Development
# Anwendung starten
ENTRYPOINT ["dotnet", "Watcher.dll"]