fujiokayu / serverless-web-driver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

deprecated and no under maintained.
recommend you to use sparticuz/chromium with playwright.
The simple procedure is documented in the repository playwright-lambda-environment.

serverless-web-driver

based on this blog post

Dockerfile

  • Selenium required not greater than Python 3.7
    • in Python 3.8, Chrome Web Driver returns 127 error
    • selenium==3.141.0

binary

% tree
.
├── Dockerfile
├── README.md
├── app.py
├── bin
│   ├── chromedriver
│   └── headless-chromium
└── headlessdriver.py

1 directory, 6 files

local build

docker build -t image-name .

Local Debug

install RIE

mkdir -p ~/.aws-lambda-rie && curl -Lo ~/.aws-lambda-rie/aws-lambda-rie https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie && chmod +x ~/.aws-lambda-rie/aws-lambda-rie

start local RIE

docker run -p 9000:8080 image-name

send request to local RIE

curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"query": "Python"}'

regist ecr

authenticate docker client

aws ecr get-login-password --region ap-northeast-1 | docker login --username AWS --password-stdin registry.region.amazonaws.com

create ecr repo

aws ecr create-repository \
    --repository-name image-name \
    --image-scanning-configuration scanOnPush=true \

tagging

docker tag image-name:latest registry.region1.amazonaws.com/image-name:latest

push

docker push registry.region.amazonaws.com/image-name:latest

Performance

  • need 1024MB memory to cold start

About


Languages

Language:Python 93.7%Language:Dockerfile 6.3%