Skip to content

Commit c5efea0

Browse files
author
Petya Koleva
committed
Update dotnet build image
1 parent 54b2417 commit c5efea0

2 files changed

Lines changed: 58 additions & 17 deletions

File tree

.github/workflows/dotnet.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ env:
2323

2424
jobs:
2525
build-dotnet:
26-
runs-on: windows-2019
26+
runs-on: windows-2025
2727
steps:
2828
- uses: actions/checkout@v4
2929
- name: Setup MSBuild
@@ -40,7 +40,7 @@ jobs:
4040
4141
build-docker:
4242
needs: build-dotnet
43-
runs-on: windows-2019
43+
runs-on: windows-2025
4444
steps:
4545
- uses: actions/checkout@v4
4646
- uses: docker/login-action@v3
@@ -63,7 +63,7 @@ jobs:
6363
6464
run-integration-tests-with-proxy:
6565
needs: build-docker
66-
runs-on: windows-2019
66+
runs-on: windows-2025
6767
steps:
6868
- name: Pull images
6969
run: |
@@ -89,7 +89,7 @@ jobs:
8989
run: |
9090
export CID=$(cat $CID_FILE)
9191
export ADDR=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $CID)
92-
echo "::set-output name=address::$ADDR"
92+
echo "address=$ADDR" >> $GITHUB_OUTPUT
9393
rm -rf $CID_FILE
9494
- name: Start the sample
9595
shell: bash
@@ -113,7 +113,7 @@ jobs:
113113
run: |
114114
export CID=$(cat $CID_FILE)
115115
export ADDR=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $CID)
116-
echo "::set-output name=address::$ADDR"
116+
echo "address=$ADDR" >> $GITHUB_OUTPUT
117117
- name: Run integration tests
118118
id: tests
119119
shell: powershell
@@ -130,7 +130,7 @@ jobs:
130130

131131
run-integration-tests:
132132
needs: build-docker
133-
runs-on: windows-2019
133+
runs-on: windows-2025
134134
steps:
135135
- name: Pull images
136136
run: |
@@ -155,7 +155,7 @@ jobs:
155155
run: |
156156
export CID=$(cat $CID_FILE)
157157
export ADDR=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $CID)
158-
echo "::set-output name=address::$ADDR"
158+
echo "address=$ADDR" >> $GITHUB_OUTPUT
159159
- name: Run integration tests
160160
id: tests
161161
shell: powershell

samples/dotnet/Dockerfile

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,63 @@
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
229
WORKDIR /app
330

31+
432
ENV HOST="localhost"
533
ENV PORT="8000"
6-
EXPOSE ${PORT}
34+
EXPOSE ${PORT}
735

836
# 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 ./
1340

14-
# copy everything else and build app
41+
# Copy the project files
1542
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
1749
RUN msbuild /p:Configuration=Release -r:False
1850

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/ .
2162

2263
COPY --from=build /app/. /app

0 commit comments

Comments
 (0)