|
1 | | -FROM mcr.microsoft.com/dotnet/framework/sdk:4.8 AS build |
| 1 | +# FROM mcr.microsoft.com/dotnet/framework/sdk:4.8 AS build |
| 2 | +# WORKDIR /app |
| 3 | + |
| 4 | +# ENV HOST="localhost" |
| 5 | +# ENV PORT="8000" |
| 6 | +# EXPOSE ${PORT} |
| 7 | + |
| 8 | +# # copy csproj and restore as distinct layers |
| 9 | +# COPY *.sln ./ |
| 10 | +# COPY *.csproj ./ |
| 11 | +# COPY *.config ./ |
| 12 | +# RUN nuget restore |
| 13 | + |
| 14 | +# # copy everything else and build app |
| 15 | +# COPY . . |
| 16 | +# WORKDIR /app |
| 17 | +# RUN msbuild /p:Configuration=Release -r:False |
| 18 | + |
| 19 | +# FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8 AS runtime |
| 20 | +# RUN New-Item -Path 'C:\app' -Type Directory; New-Website -Name 'app' -PhysicalPath 'C:\app' -Port 8000 -Force |
| 21 | + |
| 22 | +# COPY --from=build /app/. /app |
| 23 | +######################################################################### |
| 24 | +# Stage 1: Build the application |
| 25 | +# Use a specific Windows Server 2022-compatible SDK image |
| 26 | +FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2022 AS build |
| 27 | + |
| 28 | +# Set the working directory |
2 | 29 | WORKDIR /app |
3 | 30 |
|
| 31 | + |
4 | 32 | ENV HOST="localhost" |
5 | 33 | ENV PORT="8000" |
6 | | -EXPOSE ${PORT} |
| 34 | +EXPOSE ${PORT} |
7 | 35 |
|
8 | 36 | # copy csproj and restore as distinct layers |
9 | | -COPY *.sln ./ |
10 | | -COPY *.csproj ./ |
11 | | -COPY *.config ./ |
12 | | -RUN nuget restore |
| 37 | +# COPY *.sln ./ |
| 38 | +# COPY *.csproj ./ |
| 39 | +# COPY *.config ./ |
13 | 40 |
|
14 | | -# copy everything else and build app |
| 41 | +# Copy the project files |
15 | 42 | COPY . . |
16 | | -WORKDIR /app |
| 43 | + |
| 44 | +# Restore NuGet packages |
| 45 | +RUN nuget restore |
| 46 | + |
| 47 | +# Build the application and publish it |
| 48 | +# RUN msbuild /p:Configuration=Release /p:DeployOnBuild=true /p:PublishProfile=FileSystem /p:publishUrl=c:\publish |
17 | 49 | RUN msbuild /p:Configuration=Release -r:False |
18 | 50 |
|
19 | | -FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8 AS runtime |
20 | | -RUN New-Item -Path 'C:\app' -Type Directory; New-Website -Name 'app' -PhysicalPath 'C:\app' -Port 8000 -Force |
| 51 | +# Stage 2: Create the runtime image |
| 52 | +# Use a compatible Windows Server 2022 ASP.NET runtime image |
| 53 | +FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2022 |
| 54 | +# RUN New-Item -Path 'C:\app' -Type Directory; New-Website -Name 'app' -PhysicalPath 'C:\app' -Port 8000 -Force |
| 55 | +RUN powershell -Command "New-Item -Path 'C:\app' -Type Directory; New-Website -Name 'app' -PhysicalPath 'C:\app' -Port 8000 -Force" |
| 56 | + |
| 57 | +# # Set the working directory for the final image |
| 58 | +# WORKDIR /inetpub/wwwroot |
| 59 | + |
| 60 | +# # Copy the published application from the build stage |
| 61 | +# COPY --from=build /publish/ . |
21 | 62 |
|
22 | 63 | COPY --from=build /app/. /app |
0 commit comments