update docker file

This commit is contained in:
Artemy
2025-11-04 12:49:41 +07:00
parent e6f7292bab
commit b1e8cc83b2
10 changed files with 24 additions and 13 deletions
+17 -6
View File
@@ -1,23 +1,34 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src WORKDIR /src
# Êîïèðóåì òîëüêî .sln è .csproj
COPY *.sln ./ COPY *.sln ./
COPY Govor.API/*.csproj Govor.API/ COPY Govor.API/*.csproj ./Govor.API/
COPY Govor.Application/*.csproj Govor.Application/ COPY Govor.Application/*.csproj ./Govor.Application/
COPY Govor.Core/*.csproj Govor.Core/ COPY Govor.Core/*.csproj ./Govor.Core/
COPY Govor.Data/*.csproj Govor.Data/ COPY Govor.Data/*.csproj ./Govor.Data/
COPY Govor.Contracts/*.csproj Govor.Contracts/ COPY Govor.Contracts/*.csproj ./Govor.Contracts/
RUN dotnet restore Govor.API/Govor.API.csproj RUN dotnet restore Govor.API/Govor.API.csproj
# Êîïèðóåì âåñü êîä
COPY . . COPY . .
# ÓÄÀËßÅÌ launchSettings.json
RUN rm -f Govor.API/Properties/launchSettings.json
WORKDIR /src/Govor.API WORKDIR /src/Govor.API
RUN dotnet publish -c Release -o /app/publish RUN dotnet publish -c Release -o /app/publish
# Runtime image
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final
WORKDIR /app WORKDIR /app
COPY --from=build /app/publish . COPY --from=build /app/publish .
# Ïðèíóäèòåëüíî óñòàíàâëèâàåì ïîðò
ENV ASPNETCORE_URLS=http://+:8080 ENV ASPNETCORE_URLS=http://+:8080
ENV ASPNETCORE_ENVIRONMENT=Production
EXPOSE 8080 EXPOSE 8080
ENTRYPOINT ["dotnet", "Govor.API.dll"] ENTRYPOINT ["dotnet", "Govor.API.dll"]
+7 -7
View File
@@ -22,12 +22,12 @@ builder.Services.AddCors(options =>
policy.WithOrigins( policy.WithOrigins(
"https://localhost:7155", "https://localhost:7155",
"http://localhost:7155", "http://localhost:7155",
"https://govor-team-govor-8ce1.twc1.net", "https://govor-team-govor-8ce1.twc1.net",
"http://govor-team-govor-8ce1.twc1.net" "http://govor-team-govor-8ce1.twc1.net"
) )
.AllowAnyHeader() .AllowAnyHeader()
.AllowAnyMethod() .AllowAnyMethod()
.AllowCredentials(); .AllowCredentials();
}); });
}); });
@@ -109,10 +109,10 @@ builder.Services.AddSwaggerGen(options =>
var app = builder.Build(); var app = builder.Build();
// Configure the HTTP request pipeline. // Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment()) if (!app.Environment.IsDevelopment())
{ {
//app.MapOpenApi(); //app.MapOpenApi();
builder.WebHost.UseUrls("http://0.0.0.0:8080");
} }
app.UseSwagger(); app.UseSwagger();
Binary file not shown.

Before

Width:  |  Height:  |  Size: 691 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 480 KiB