refactor: migrate from nginx to aspnet runtime
Some checks failed
Build and Deploy / build (push) Failing after 13s

This commit is contained in:
masoodafar-web
2025-12-08 01:55:13 +03:30
parent 410f31671d
commit b51a4b51cc

View File

@@ -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"]