File tree Expand file tree Collapse file tree 3 files changed +44
-14
lines changed
Solution/Exercise-03/Task-3
src/Application/src/RazorPagesTestSample Expand file tree Collapse file tree 3 files changed +44
-14
lines changed Original file line number Diff line number Diff line change 1
- # This workflow will build a .NET project
2
- # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3
-
4
- name : .NET
1
+ name : .NET CI
5
2
6
3
on :
7
4
push :
8
- branches : [ "main" ]
5
+ branches : [ main ]
6
+ paths : src/Application/**
9
7
pull_request :
10
- branches : [ "main" ]
11
-
8
+ branches : [ main ]
9
+ paths : src/Application/**
10
+ # Allows you to run this workflow manually from the Actions tab
11
+ workflow_dispatch :
12
12
jobs :
13
13
build :
14
14
15
15
runs-on : ubuntu-latest
16
16
17
17
steps :
18
- - uses : actions/checkout@v4
18
+ - uses : actions/checkout@v3
19
19
- name : Setup .NET
20
- uses : actions/setup-dotnet@v4
21
- with :
22
- dotnet-version : 8.0.x
20
+ uses : actions/setup-dotnet@v3
21
+
23
22
- name : Restore dependencies
24
- run : dotnet restore
23
+ run : dotnet restore ./src/Application/src/RazorPagesTestSample/RazorPagesTestSample.csproj
25
24
- name : Build
26
- run : dotnet build --no-restore
25
+ run : dotnet build --no-restore ./src/Application/src/RazorPagesTestSample/RazorPagesTestSample.csproj
27
26
- name : Test
28
- run : dotnet test --no-build --verbosity normal
27
+ run : dotnet test --no-build --verbosity normal ./src/Application/tests/RazorPagesTestSample.Tests/RazorPagesTestSample.Tests.csproj
Original file line number Diff line number Diff line change 25
25
run : dotnet build --no-restore ./src/Application/src/RazorPagesTestSample/RazorPagesTestSample.csproj
26
26
- name : Test
27
27
run : dotnet test --no-build --verbosity normal ./src/Application/tests/RazorPagesTestSample.Tests/RazorPagesTestSample.Tests.csproj
28
+
Original file line number Diff line number Diff line change
1
+ # Use the official .NET SDK image as the base image
2
+ FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
3
+
4
+ # Set the working directory inside the container
5
+ WORKDIR /app
6
+
7
+ # Copy the project file and restore dependencies
8
+ COPY *.csproj ./
9
+ RUN dotnet restore
10
+
11
+ # Copy the remaining source code
12
+ COPY . ./
13
+
14
+ # Build the application
15
+ RUN dotnet publish -c Release -o out
16
+
17
+ # Use the official ASP.NET Core runtime image as the base image
18
+ FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
19
+
20
+ # Set the working directory inside the container
21
+ WORKDIR /app
22
+
23
+ # Copy the published output from the build stage
24
+ COPY --from=build /app/out ./
25
+
26
+ # Set the environment variable
27
+ ENV ASPNETCORE_HTTP_PORTS=80
28
+
29
+ # Set the entry point of the application
30
+ ENTRYPOINT ["dotnet" , "RazorPagesTestSample.dll" ]
You can’t perform that action at this time.
0 commit comments