File tree Expand file tree Collapse file tree 3 files changed +110
-0
lines changed Expand file tree Collapse file tree 3 files changed +110
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Build and Test
2
+
3
+ on :
4
+ push :
5
+ branches : [ main ]
6
+ pull_request :
7
+ branches : [ main ]
8
+ paths-ignore :
9
+ - ' README.md'
10
+
11
+ env :
12
+ DOTNET_VERSION : ' 9.0.x'
13
+
14
+ jobs :
15
+ build-and-test :
16
+ name : build-and-test-${{matrix.os}}
17
+ runs-on : ${{ matrix.os }}
18
+ strategy :
19
+ matrix :
20
+ os : [ubuntu-latest]
21
+ steps :
22
+ - uses : actions/checkout@v4
23
+
24
+ - name : Setup .NET
25
+ uses : actions/setup-dotnet@v4
26
+ with :
27
+ dotnet-version : ${{ env.DOTNET_VERSION }}
28
+
29
+ - name : Restore dependencies
30
+ working-directory : ./src/DigmaSSEServer
31
+ run : dotnet restore
32
+
33
+ - name : Build
34
+ working-directory : ./src/DigmaSSEServer
35
+ run : dotnet build --no-restore
36
+
37
+ - name : Test
38
+ working-directory : ./src/DigmaSSEServer
39
+ run : dotnet test --no-build --verbosity normal
Original file line number Diff line number Diff line change
1
+ name : Publish Docker Image
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ release :
6
+ types : [released]
7
+
8
+ permissions :
9
+ packages : write
10
+ contents : read
11
+
12
+ jobs :
13
+ build-and-push :
14
+ runs-on : ubuntu-latest
15
+ steps :
16
+ - name : Checkout repository
17
+ uses : actions/checkout@v4
18
+
19
+ - name : Set up Docker Buildx
20
+ uses : docker/setup-buildx-action@v3
21
+
22
+ - name : Login to Docker Hub
23
+ uses : docker/login-action@v3
24
+ with :
25
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
26
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
27
+
28
+ - name : Extract metadata for Docker
29
+ id : meta
30
+ uses : docker/metadata-action@v5
31
+ with :
32
+ images : digmatic/digma-sse-server
33
+ tags : |
34
+ type=schedule
35
+ type=ref,event=branch
36
+ type=ref,event=pr
37
+ type=semver,pattern={{version}}
38
+ type=semver,pattern={{major}}.{{minor}}
39
+ type=semver,pattern={{major}}
40
+ type=sha
41
+ type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
42
+
43
+ - name : Build and push Docker image
44
+ uses : docker/build-push-action@v5
45
+ with :
46
+ context : .
47
+ file : ./src/DigmaSSEServer/Dockerfile
48
+ push : true
49
+ tags : ${{ steps.meta.outputs.tags }}
50
+ labels : ${{ steps.meta.outputs.labels }}
Original file line number Diff line number Diff line change
1
+ FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
2
+ WORKDIR /app
3
+ EXPOSE 80
4
+ EXPOSE 443
5
+
6
+ FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
7
+ WORKDIR /src
8
+ COPY ["src/DigmaSSEServer/DigmaSSEServer.csproj" , "./" ]
9
+ RUN dotnet restore "DigmaSSEServer.csproj"
10
+ COPY src/DigmaSSEServer/. ./
11
+ RUN dotnet build "DigmaSSEServer.csproj" -c Release -o /app/build /p:UseAppHost=false
12
+
13
+ FROM build AS publish
14
+ RUN dotnet publish "DigmaSSEServer.csproj" -c Release -o /app/publish /p:UseAppHost=false
15
+
16
+ FROM base AS final
17
+ WORKDIR /app
18
+ COPY --from=publish /app/publish .
19
+ ENV ASPNETCORE_URLS=http://+:80
20
+ ENV ASPNETCORE_ENVIRONMENT=Production
21
+ ENTRYPOINT ["dotnet" , "DigmaSSEServer.dll" ]
You can’t perform that action at this time.
0 commit comments