Also, we need to install aws-lambda-ric to make our image compatible with AWS Lambda. Puppeteer runs in headless mode by default, but can be configured to run in full (non-headless) Chrome/Chromium. Quoting its homepage: Puppeteer is a Node.js library which provides a high-level API to control Chrome/Chromium over the DevTools Protocol. This dockerfile is based on Google recommendations on how to pack puppeteer in docker. Puppeteer is an API enabling browser automation via Chrome/Chromium. Those are typically denoted by a beta suffix, but it can vary depending on our needs. Lets build a custom Docker image to fully control the runtime environment, dependencies, and browser version. We also build pre-release versions of the images to test the changes we make. Installing apify/actor-node-puppeteer-chrome (without a tag) will install the latest available version of Node.js and puppeteer. Similarly apify/actor-node-playwright-firefox:14-1.10.0 runs on Node.js 14 and is pre-installed with the Firefox version that comes with v1.10.0. If you try to install a different version of Puppeteer into this image, you may run into compatibility issues, because the Chromium version bundled with puppeteer will not match the version of Chrome we pre-installed. For example, apify/actor-node-puppeteer-chrome:16-8.0.0 comes with Node.js 16 and Puppeteer v8.0.0. Images that include a pre-installed automation library, which means all images that include puppeteer or playwright in their name, are also tagged with the pre-installed version of the library. # In short, the instruction looks something like this: chromium puppeteer alpine The chrome-headless project provides a Docker image. # in the "scripts.start" section of the package.json file. Chrome Headless docker images built upon alpine official image Node. # that runs the Node.js source code using the command specified # By default, Apify's base Docker images define the CMD instruction # Optionally, specify how to launch the source code of your actor. # Since we do this after NPM install, quick build will be really fast # Next, copy the remaining files and directories with the source code. Avoid logging too much and print the dependency # Install NPM packages, skip optional and development dependencies to # the only file that affects "npm install" in the next step, to speed up the build # Second, copy just package.json and package-lock.json since it should be # The 16 represents the version of Node.js you want to use. # You can also use any other image from Docker Hub.
0 Comments
Leave a Reply. |