jeudi 1 avril 2021

Execute dotnet test command with docker

I'm trying to execute an xunit test project with docker. The command I need to execute is this one:

dotnet test "/src/Test.dll" --filter "Test.ApiTest" 

This is the docker file that Visual Studio created:

FROM mcr.microsoft.com/dotnet/runtime:5.0 AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["Test.csproj", "."]
RUN dotnet restore "./Test.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "Test.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Test.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Test.dll"]

How can I modify this file so that executes the command I need?

Regards.

Aucun commentaire:

Enregistrer un commentaire