Skip to content

Commit 7ccdcd8

Browse files
authored
Update Dockerfile
1 parent 23fd87c commit 7ccdcd8

1 file changed

Lines changed: 9 additions & 16 deletions

File tree

Dockerfile

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
1-
# Use the official ASP.NET Core runtime as a parent image
2-
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
1+
# Use official ASP.NET Core image as the base
2+
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
33
WORKDIR /app
44
EXPOSE 80
5-
EXPOSE 443
5+
ENV ASPNETCORE_URLS=http://+:80
66

7-
# Use the official .NET SDK as a build image
8-
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
7+
# Build stage
8+
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
99
WORKDIR /src
10-
COPY ["src/NetworkInfrastructure.Web/NetworkInfrastructure.Web.csproj", "NetworkInfrastructure.Web/"]
11-
# Copy other .csproj files if there are any in the solution that NetworkInfrastructure.Web depends on
12-
# For example: COPY ["src/NetworkInfrastructure.AnotherProject/NetworkInfrastructure.AnotherProject.csproj", "NetworkInfrastructure.AnotherProject/"]
13-
RUN dotnet restore "NetworkInfrastructure.Web/NetworkInfrastructure.Web.csproj"
1410
COPY . .
15-
WORKDIR "/src/NetworkInfrastructure.Web"
16-
RUN dotnet build "NetworkInfrastructure.Web.csproj" -c Release -o /app/build
11+
RUN dotnet restore
12+
RUN dotnet publish -c Release -o /app/publish
1713

18-
FROM build AS publish
19-
RUN dotnet publish "NetworkInfrastructure.Web.csproj" -c Release -o /app/publish /p:UseAppHost=false
20-
21-
# Build runtime image
14+
# Final stage
2215
FROM base AS final
2316
WORKDIR /app
24-
COPY --from=publish /app/publish .
17+
COPY --from=build /app/publish .
2518
ENTRYPOINT ["dotnet", "NetworkInfrastructure.Web.dll"]

0 commit comments

Comments
 (0)