-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
27 lines (20 loc) · 888 Bytes
/
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
# Use the .NET 8.0 SDK image to build the application
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
# Copy the solution file
# Using a wildcard to copy the solution file, suitable if there's only one .sln file in the root
COPY *.sln .
# Copy the csproj files and restore as distinct layers
COPY Authlete/Authlete.csproj Authlete/
COPY Authlete.Tests/Authlete.Tests.csproj Authlete.Tests/
# Restore NuGet packages
RUN dotnet restore "Authlete.sln" -v d
# Copy the rest of the source code
COPY . .
# Build the project
RUN dotnet build "Authlete/Authlete.csproj" -c Release -o /app/build
# Run tests and generate TRX test results
RUN dotnet test "Authlete.Tests/Authlete.Tests.csproj" -c Release --no-restore --logger "trx;LogFileName=test_results.trx"
# Copy test results to a known location
RUN mkdir /test-results
RUN cp Authlete.Tests/TestResults/*.trx /test-results