From b51a4b51cc2661061444bc2b4952775e87dd1592 Mon Sep 17 00:00:00 2001 From: masoodafar-web Date: Mon, 8 Dec 2025 01:55:13 +0330 Subject: [PATCH] refactor: migrate from nginx to aspnet runtime --- src/FrontOffice.Main/Dockerfile | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/FrontOffice.Main/Dockerfile b/src/FrontOffice.Main/Dockerfile index b08f7ac..51f47cf 100644 --- a/src/FrontOffice.Main/Dockerfile +++ b/src/FrontOffice.Main/Dockerfile @@ -1,24 +1,15 @@ FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build WORKDIR /src -COPY ["FrontOffice.Main/NuGet.config", "NuGet.config"] -COPY ["FrontOffice.Main/FrontOffice.Main.csproj", "FrontOffice.Main/"] -RUN dotnet restore "FrontOffice.Main/FrontOffice.Main.csproj" --configfile NuGet.config -COPY . . -WORKDIR "/src/FrontOffice.Main" -RUN dotnet publish "./FrontOffice.Main.csproj" -c Release -o /app/publish +COPY src/*.sln ./ 2>/dev/null || true +COPY src/*/*.csproj ./ +RUN for file in *.csproj; do mkdir -p "${file%.*}" && mv "$file" "${file%.*}/"; done 2>/dev/null || true +RUN dotnet restore "FrontOffice/FrontOffice.csproj" || dotnet restore +COPY src/ ./ +RUN dotnet publish "FrontOffice/FrontOffice.csproj" -c Release -o /app/publish -FROM nginx:alpine AS final -WORKDIR /usr/share/nginx/html -COPY --from=build /app/publish/wwwroot . -COPY <<'NGINX_CONF' /etc/nginx/conf.d/default.conf -server { - listen 80; - server_name _; - - location / { - root /usr/share/nginx/html; - try_files $uri $uri/ /index.html; - } -} -NGINX_CONF -EXPOSE 80 +FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime +WORKDIR /app +COPY --from=build /app/publish . +ENV ASPNETCORE_URLS=http://+:8080 +EXPOSE 8080 +ENTRYPOINT ["dotnet", "FrontOffice.dll"]