This repository has been archived by the owner on Jun 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathDockerfile
53 lines (40 loc) · 1.53 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app
COPY ./src/EasyAuthForK8s.sln ./EasyAuthForK8s.sln
COPY ./src/EasyAuthForK8s.Web/EasyAuthForK8s.Web.csproj \
./EasyAuthForK8s.Web/EasyAuthForK8s.Web.csproj
COPY ./src/Tests/EasyAuthForK8s.Tests.Web/EasyAuthForK8s.Tests.Web.csproj \
./Tests/EasyAuthForK8s.Tests.Web/EasyAuthForK8s.Tests.Web.csproj
RUN dotnet restore
COPY ./src/EasyAuthForK8s.Web ./EasyAuthForK8s.Web
COPY ./src/Tests/EasyAuthForK8s.Tests.Web ./Tests/EasyAuthForK8s.Tests.Web
#test
LABEL test=true
RUN dotnet tool install dotnet-reportgenerator-globaltool \
--version 5.0.0 \
--tool-path /tools
RUN dotnet test \
--results-directory /testresults \
--logger "trx;LogFileName=test_results.xml" \
/p:CollectCoverage=true \
/p:CoverletOutputFormat=cobertura \
/p:CoverletOutput=/testresults/coverage/ \
/p:Exclude="[xunit.*]*%2c[EasyAuthForK8s.Tests.Web]" \
./Tests/EasyAuthForK8s.Tests.Web/EasyAuthForK8s.Tests.Web.csproj
RUN /tools/reportgenerator \
"-reports:/testresults/coverage/coverage.cobertura.xml" \
"-targetdir:/testresults/coverage/reports" \
"-reporttypes:HTMLInline;HTMLChart"
RUN ls -la /testresults/coverage/reports
RUN dotnet publish \
./EasyAuthForK8s.Web/EasyAuthForK8s.Web.csproj \
-c Release \
-r linux-musl-x64 \
--self-contained true \
/p:PublishTrimmed=true \
-o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["./EasyAuthForK8s.Web"]