using var browserFetcher = new BrowserFetcher();
var revisionInfo = await browserFetcher.DownloadAsync();
string executablePath = revisionInfo.GetExecutablePath();
// 启动 Chromium,设置为无头模式
var browser = await Puppeteer.LaunchAsync(new LaunchOptions
{
Headless = true,
ExecutablePath = executablePath,
//Args = ["--no-sandbox"]
});
// 打开一个新的页面
var page = await browser.NewPageAsync();
this is my dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER root
WORKDIR /app
EXPOSE 8080
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["Signin.csproj", "."]
RUN dotnet restore "./././Signin.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "./Signin.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./Signin.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
RUN apt-get update && \
apt-get install -y libglib2.0-0 && \
rm -rf /var/lib/apt/lists/*
ENV LANG=C.UTF-8
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Signin.dll"]
Code running error
Failed to launch browser!
at PuppeteerSharp.States.ProcessStartingState.StartCoreAsync(LauncherBase p) in /home/runner/work/puppeteer-sharp/puppeteer-sharp/lib/PuppeteerSharp/States/ProcessStartingState.cs:line 83
at PuppeteerSharp.States.ProcessStartingState.StartCoreAsync(LauncherBase p) in /home/runner/work/puppeteer-sharp/puppeteer-sharp/lib/PuppeteerSharp/States/ProcessStartingState.cs:line 89
at PuppeteerSharp.Launcher.LaunchAsync(LaunchOptions options) in /home/runner/work/puppeteer-sharp/puppeteer-sharp/lib/PuppeteerSharp/Launcher.cs:line 66
at PuppeteerSharp.Launcher.LaunchAsync(LaunchOptions options) in /home/runner/work/puppeteer-sharp/puppeteer-sharp/lib/PuppeteerSharp/Launcher.cs:line 99
at Signin.Service.PTSigninService.<>c__DisplayClass0_0.<<AddModuleRoutes>b__3>d.MoveNext() in /src/Service/PTSigninService.cs:line 110"
this is my code
this is my dockerfile
Code running error
Please advise on how to solve it, thank you