无法 运行 PlayWright 在 docker 图像中
Cannot run PlayWright inside docker image
我正在尝试与剧作家一起创建 .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
尽管我的 docker 文件包含 RUN npx playwright install
似乎没有安装它。当我将它从我的 docker 文件中删除并在 运行ning 图像上手动执行时,它似乎没问题。关于如何使用 dockerfile 正确执行 playwright install 的任何想法?
我正在尝试与剧作家一起创建 .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
尽管我的 docker 文件包含 RUN npx playwright install
似乎没有安装它。当我将它从我的 docker 文件中删除并在 运行ning 图像上手动执行时,它似乎没问题。关于如何使用 dockerfile 正确执行 playwright install 的任何想法?