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

Docker example #721

Merged
merged 1 commit into from Sep 8, 2017
Merged

Docker example #721

merged 1 commit into from Sep 8, 2017

Conversation

ebidel
Copy link
Contributor

@ebidel ebidel commented Sep 8, 2017

No description provided.

Copy link
Contributor

@aslushnikov aslushnikov left a 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"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this necessary?

Copy link
Contributor Author

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:
Copy link
Contributor

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

Copy link
Contributor Author

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

@ebidel ebidel merged commit 8d2a427 into master Sep 8, 2017
@ebidel ebidel deleted the docker branch September 8, 2017 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants