Reputation: 133
I need to be able to create a Docker image of my Nunit Playwright test project, but I am having a lot of trouble understanding which runtime image to use and then finally if I need to install playwright or not, or do I need to use Entry-point ["dotnet", "test", "app.dll"] or not?
My Dockerfile looks like the following. I am trying to use the latest official .NET Playwright image, Playwright tells you to use here https://playwright.dev/dotnet/docs/docker, so I am not installing all the Playwright dependencies and making a mistake there, but also this isn't completely correct.
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /app
COPY Sample.Api ./Api
COPY Sample.UI ./UI
COPY Sample.Common ./Common
COPY Sample.DataModels ./DataModels
COPY Sample.Extension ./Extension
COPY Sample.Test ./Test
COPY pipeline/dev-variables.yml ./pipeline/
RUN dotnet restore "./Test "
RUN dotnet build "./Test " -c BUILD_CONFIGURATION -o /app/build
FROM build AS publish
RUN dotnet publish "./Test" -c BUILD_CONFIGURATION -o ./publish /p:UseAppHost=false --no-restore
FROM mcr.microsoft.com/playwright/dotnet:latest
WORKDIR /app
COPY --from=publish /app/publish .
COPY --from=publish /app/pipeline/dev-variables.yml ./pipeline/
CMD ["dotnet","test", "Test.dll"]
How can I get this working? Playwright gives you the image, but no examples of how to use it, and it's been a bit frustrating figuring out the right way to do this.
I would like, when the container spins up, it automatically runs all the tests in the test project.
The current errors I'm seeing are the ones below:
Upvotes: 0
Views: 75