-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Docker example #721
Docker example #721
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! WDYT about publishing this on dockerhub? This would allow others to extend easily
# Install puppeteer so it can be required by user code that gets ran in server.js. | ||
RUN yarn add puppeteer | ||
|
||
CMD ["google-chrome-unstable", "--no-sandbox"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, I think you have to have a default CMD or ENTRYPOINT.
docker build -t puppeteer-chrome-linux . | ||
``` | ||
|
||
Run the container by passing `node -e "<yourscript.js content as a string>` as the command: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also mount the current folder inside the container and run node there.
Example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about that. The problem is if you run this on App Engine (possibly others), there's no way to control the run command. It runs yarn start
for you. That's why I made something that also works well with a server endpoint: https://github.com/ebidel/try-puppeteer#running-the-container
No description provided.