我正在尝试用playwright创建.net 5.0 docker图像。这是我的DockerFile:
FROM mcr.microsoft.com/dotnet/runtime:5.0-buster-slim AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
WORKDIR /src
COPY ["Agent.csproj", "Agent/"]
RUN dotnet restore "Agent/Agent.csproj"
COPY . "/src/Agent"
WORKDIR "/src/Agent"
RUN apt-get update -yq && apt-get upgrade -yq && apt-get install -yq curl git nano
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -yq nodejs build-essential
RUN npm install -g npm
RUN dotnet add package Microsoft.Playwright
RUN dotnet build "Agent.csproj" -c Release -o /app/build
RUN npx playwright install但是一旦我在我的镜像命令dotnet run Agent中运行,它就会给我以下错误:
Executable doesn't exist at /root/.cache/ms-playwright/chromium-907428/chrome-linux/chrome
Please run the following command to download new browsers:
║
║ npx playwright install尽管我的dockerfile文件包含RUN npx playwright install,但它似乎没有安装它。当我将它从我的dockerfile中移除,并在运行的镜像上手动执行它时,它看起来是可以的。你知道如何使用dockerfile正确执行playwright安装吗?
https://stackoverflow.com/questions/69472876
复制相似问题