Skip to content

estruyf/azure-function-node-puppeteer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Azure Functions Docker image with support for Puppeteer

Pulls from Docker Hub Stars on Docker Hub

Why use this image?

You probably want to use Puppeteer in your Azure Function. This Docker image got you covered.

Usage

Initialize a new project for your Azure Functions:

func init --docker

Update the Dockerfile with the following contents:

FROM estruyf/azure-function-node-puppeteer

COPY . /home/site/wwwroot

Using Puppeteer

Once you create a new Azure Function, you can use it like this sample:

const puppeteer = require('puppeteer');

module.exports = async (context, req) => {    
    const browser = await puppeteer.launch({
        args: [
            '--no-sandbox',
            '--disable-setuid-sandbox'
        ]
    });

    const page = await browser.newPage();
    await page.goto('https://www.eliostruyf.com');
    const pageTitle = await page.title();
    await browser.close();

    context.res = {
        // status: 200, /* Defaults to 200 */
        body: `Page title: ${pageTitle}`
    };
};

About

Azure Functions Docker image with Puppeteer

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages