FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /src COPY ["OpenRHCall.csproj", "./"] RUN dotnet restore COPY . . RUN dotnet publish -c Release -o /app/publish FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final WORKDIR /app # Install dependencies for Chrome RUN apt-get update && apt-get install -y \ wget \ gnupg2 \ apt-transport-https \ ca-certificates \ libglib2.0-0 \ libnss3 \ libatk1.0-0 \ libatk-bridge2.0-0 \ libcups2 \ libdrm2 \ libxkbcommon0 \ libxcomposite1 \ libxdamage1 \ libxfixes3 \ libxrandr2 \ libgbm1 \ libpango-1.0-0 \ libcairo2 \ libasound2 \ libxcb1 \ libxcb-dri3-0 \ libxcursor1 \ libxtst6 \ fonts-ipafont-gothic \ fonts-wqy-zenhei \ fonts-thai-tlwg \ fonts-kacst \ fonts-symbola \ fonts-noto \ fonts-freefont-ttf \ --no-install-recommends \ && rm -rf /var/lib/apt/lists/* # Install Chrome RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ && apt-get update \ && apt-get install -y google-chrome-stable --no-install-recommends \ && rm -rf /var/lib/apt/lists/* # Create chrome-user and configure permissions RUN groupadd -r chrome-user \ && useradd -r -g chrome-user -G audio,video chrome-user \ && mkdir -p /home/chrome-user/Downloads \ && mkdir -p /app/.local/share \ && chown -R chrome-user:chrome-user /home/chrome-user \ && chown -R chrome-user:chrome-user /app # Copy published app COPY --from=build /app/publish . RUN chown -R chrome-user:chrome-user /app # Set environment variables for Chrome ENV PUPPETEER_EXECUTABLE_PATH "/usr/bin/google-chrome-stable" ENV CHROME_EXECUTABLE_PATH "/usr/bin/google-chrome-stable" # Switch to chrome-user USER chrome-user EXPOSE 8080 EXPOSE 80 ENTRYPOINT ["dotnet", "OpenRHCall.dll"]