Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chrome.exe can't be found in docker container #99

Closed
ClinchClonch opened this issue Feb 28, 2023 · 2 comments
Closed

Chrome.exe can't be found in docker container #99

ClinchClonch opened this issue Feb 28, 2023 · 2 comments
Labels

Comments

@ClinchClonch
Copy link

ClinchClonch commented Feb 28, 2023

Hi. I'm trying to get this library to work inside of a docker container running Linux, but it fails to locate Chrome.exe, logging the error message System.IO.FileNotFoundException: Could not find chrome.exe in location ''

I've tried a few different ways of installing Chrome, but run into the same issue regardless. The console output when docker is building doesn't throw any exceptions when installing it and it looks to me as if it's successful, but once it's completed I can't locate it anywhere. A whereis google-chrome shows nothing, and I can't find it when looking manually either under usr/bin and other paths.

I've also tried adding the --no-sandbox argument to the converter just in case, but it didn't help either.

My dockerfile looks like this:

FROM mcr.microsoft.com/dotnet/aspnet:6.0 as builder
WORKDIR /build

COPY pdf.api ./pdf.api
COPY pdf.api.sln .
COPY nuget.config .

RUN dotnet restore pdf.api.sln --configfile ./nuget.config --force --verbosity quiet
RUN dotnet publish pdf.api/pdf.api.csproj --verbosity minimal --output /build/release -r linux-x64 -c Release --no-restore --sc true

ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && apt-get install -y \
	apt-transport-https \
	ca-certificates \
	curl \
	gnupg \
	--no-install-recommends \
	&& curl -sSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
	&& echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
	&& apt-get update && apt-get install -y \
	google-chrome-stable \
	--no-install-recommends \
	&& apt-get purge --auto-remove -y curl gnupg \
	&& rm -rf /var/lib/apt/lists/*

RUN apt-get update && \
    apt-get install -y unzip && \
    wget https://chromedriver.storage.googleapis.com/2.31/chromedriver_linux64.zip && \
    unzip chromedriver_linux64.zip && \
    mv chromedriver /usr/bin && rm -f chromedriver_linux64.zip

FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /release
COPY --from=builder /build/release .
EXPOSE 8080
ENTRYPOINT ["dotnet","pdf.api.dll"]

I'm not very experienced with Linux or Docker, so I'm not sure it's a problem with the library itself, but I'm really struggling in locating the culprit so any help would be greatly appreciated.

@Sicos1977
Copy link
Owner

I have no experience with docker in combination with this library but you could look into issue #39 to see if that is any help.

@ClinchClonch
Copy link
Author

It was caused by a clumsy beginner mistake of the apt-get installation being within the context of the builder, not the final build in the Dockerfile. So it was completely unrelated to the library itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants