|
| 1 | +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS restore |
| 2 | +WORKDIR /src |
| 3 | + |
| 4 | +COPY MaIN.Domain/MaIN.Domain.csproj MaIN.Domain/ |
| 5 | +COPY MaIN.Infrastructure/MaIN.Infrastructure.csproj MaIN.Infrastructure/ |
| 6 | +COPY MaIN.Services/MaIN.Services.csproj MaIN.Services/ |
| 7 | +COPY MaIN.Core/MaIN.Core.csproj MaIN.Core/ |
| 8 | +COPY MaIN.InferPage/MaIN.InferPage.csproj MaIN.InferPage/ |
| 9 | + |
| 10 | +RUN dotnet restore MaIN.InferPage/MaIN.InferPage.csproj |
| 11 | + |
| 12 | +FROM restore AS publish |
| 13 | + |
| 14 | +COPY MaIN.Domain/ MaIN.Domain/ |
| 15 | +COPY MaIN.Infrastructure/ MaIN.Infrastructure/ |
| 16 | +COPY MaIN.Services/ MaIN.Services/ |
| 17 | +COPY MaIN.Core/ MaIN.Core/ |
| 18 | +COPY MaIN.InferPage/ MaIN.InferPage/ |
| 19 | + |
| 20 | +RUN dotnet publish MaIN.InferPage/MaIN.InferPage.csproj \ |
| 21 | + --framework net10.0 \ |
| 22 | + --configuration Release \ |
| 23 | + --no-restore \ |
| 24 | + --output /app/out |
| 25 | + |
| 26 | +FROM nvidia/cuda:12.9.1-runtime-ubuntu24.04 AS runtime-cuda |
| 27 | + |
| 28 | +RUN apt-get update \ |
| 29 | + && apt-get install -y --no-install-recommends \ |
| 30 | + ca-certificates \ |
| 31 | + libicu74 \ |
| 32 | + libgomp1 \ |
| 33 | + && rm -rf /var/lib/apt/lists/* |
| 34 | + |
| 35 | +COPY --from=mcr.microsoft.com/dotnet/aspnet:10.0 /usr/share/dotnet /usr/share/dotnet |
| 36 | +RUN ln -sf /usr/share/dotnet/dotnet /usr/local/bin/dotnet |
| 37 | + |
| 38 | +WORKDIR /app |
| 39 | + |
| 40 | +ENV DOTNET_ROOT=/usr/share/dotnet |
| 41 | +ENV ASPNETCORE_URLS=http://+:5555 |
| 42 | +ENV ASPNETCORE_ENVIRONMENT=Production |
| 43 | +ENV MaIN__ModelsPath=/app/Models |
| 44 | +ENV NVIDIA_VISIBLE_DEVICES=all |
| 45 | +ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility |
| 46 | +ENV LD_LIBRARY_PATH=/usr/lib/wsl/lib |
| 47 | + |
| 48 | +VOLUME /app/Models |
| 49 | +EXPOSE 5555 |
| 50 | + |
| 51 | +COPY --from=publish /app/out . |
| 52 | + |
| 53 | +RUN find /app/runtimes/linux-x64/native -maxdepth 2 -mindepth 1 -type d \ |
| 54 | + | tee /etc/ld.so.conf.d/llamasharp.conf \ |
| 55 | + && ldconfig |
| 56 | + |
| 57 | +ENTRYPOINT ["dotnet", "MaIN.InferPage.dll"] |
| 58 | + |
| 59 | +FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime-cpu |
| 60 | + |
| 61 | +RUN apt-get update && apt-get install -y --no-install-recommends libgomp1 \ |
| 62 | + && rm -rf /var/lib/apt/lists/* |
| 63 | + |
| 64 | +WORKDIR /app |
| 65 | + |
| 66 | +ENV ASPNETCORE_URLS=http://+:5555 |
| 67 | +ENV ASPNETCORE_ENVIRONMENT=Production |
| 68 | +ENV MaIN__ModelsPath=/app/Models |
| 69 | + |
| 70 | +VOLUME /app/Models |
| 71 | +EXPOSE 5555 |
| 72 | + |
| 73 | +COPY --from=publish /app/out . |
| 74 | + |
| 75 | +ENTRYPOINT ["dotnet", "MaIN.InferPage.dll"] |
| 76 | + |
| 77 | +FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime-ollama |
| 78 | + |
| 79 | +WORKDIR /app |
| 80 | + |
| 81 | +ENV ASPNETCORE_URLS=http://+:5555 |
| 82 | +ENV ASPNETCORE_ENVIRONMENT=Production |
| 83 | +ENV MaIN__OllamaBaseUrl=http://host.docker.internal:11434 |
| 84 | +ENV MaIN__BackendType=7 |
| 85 | + |
| 86 | +EXPOSE 5555 |
| 87 | + |
| 88 | +COPY --from=publish /app/out . |
| 89 | + |
| 90 | +ENTRYPOINT ["dotnet", "MaIN.InferPage.dll"] |
| 91 | + |
| 92 | +FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime-ollama-bundled |
| 93 | + |
| 94 | +COPY --from=ollama/ollama:latest /usr/bin/ollama /usr/bin/ollama |
| 95 | + |
| 96 | +WORKDIR /app |
| 97 | + |
| 98 | +ENV ASPNETCORE_URLS=http://+:5555 |
| 99 | +ENV ASPNETCORE_ENVIRONMENT=Production |
| 100 | +ENV MaIN__OllamaBaseUrl=http://localhost:11434 |
| 101 | +ENV MaIN__BackendType=7 |
| 102 | + |
| 103 | +VOLUME /root/.ollama |
| 104 | +EXPOSE 5555 |
| 105 | +EXPOSE 11434 |
| 106 | + |
| 107 | +COPY --from=publish /app/out . |
| 108 | +COPY entrypoint-ollama.sh /entrypoint.sh |
| 109 | +RUN chmod +x /entrypoint.sh |
| 110 | + |
| 111 | +ENTRYPOINT ["/entrypoint.sh"] |
0 commit comments