I've been trying to get puppeteer running in this Dockerfile.
FROM hayd/deno-lambda:1.13.2
ENV PUPPETEER_PRODUCT=chrome
RUN deno run -A --unstable https://deno.land/x/[email protected]/install.ts
COPY hello.ts .
RUN deno cache --unstable hello.ts
CMD ["hello.handler"]
import {
APIGatewayProxyEventV2,
APIGatewayProxyResultV2,
Context,
} from "https://deno.land/x/lambda/mod.ts";
import puppeteer from "https://deno.land/x/[email protected]/mod.ts";
export async function handler(
event: APIGatewayProxyEventV2,
context: Context,
): Promise<APIGatewayProxyResultV2> {
console.log('start');
const browser = await puppeteer.launch({
headless: true,
args: [
"--no-sandbox",
"--disable-dev-shm-usage",
]
});
const page = (await browser.pages())[0];
await browser.close();
console.log('finish');
return {
statusCode: 200,
headers: { "content-type": "text/html;charset=utf8" },
body: `Welcome to deno ${Deno.version.deno} 🦕`,
};
}