{"id":28718745,"url":"https://github.com/sjw7444/lambda-playwright-python","last_synced_at":"2025-08-19T08:34:21.882Z","repository":{"id":292278470,"uuid":"980383844","full_name":"sjw7444/lambda-playwright-python","owner":"sjw7444","description":"Base Docker image for running Playwright with Python on AWS Lambda","archived":false,"fork":false,"pushed_at":"2025-08-06T22:51:07.000Z","size":26,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-07T00:19:30.170Z","etag":null,"topics":["docker","lambda","playwright","playwright-python"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/sjw7444/lambda-playwright-python","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sjw7444.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-09T03:28:06.000Z","updated_at":"2025-08-06T22:31:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"e2c53771-c8bc-4661-9bcc-4341529bb75e","html_url":"https://github.com/sjw7444/lambda-playwright-python","commit_stats":null,"previous_names":["sjw7444/lambda-playwright-python"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/sjw7444/lambda-playwright-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjw7444%2Flambda-playwright-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjw7444%2Flambda-playwright-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjw7444%2Flambda-playwright-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjw7444%2Flambda-playwright-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sjw7444","download_url":"https://codeload.github.com/sjw7444/lambda-playwright-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjw7444%2Flambda-playwright-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271121966,"owners_count":24702913,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","lambda","playwright","playwright-python"],"created_at":"2025-06-15T05:03:35.583Z","updated_at":"2025-08-19T08:34:21.874Z","avatar_url":"https://github.com/sjw7444.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lambda Playwright Python Base Image\n\n[![Deploy Docker Image](https://github.com/sjw7444/lambda-playwright-python/actions/workflows/deploy.yml/badge.svg)](https://github.com/sjw7444/lambda-playwright-python/actions/workflows/deploy.yml)\n\nThis repository contains a base Docker image for running Playwright with Python on AWS Lambda with ARM support. The image is optimized for serverless environments and includes all necessary dependencies for headless Chromium browser automation.\n\n## Access the image using Docker Hub or AWS ECR\n\n- [Docker Hub](https://hub.docker.com/r/sjw7444/lambda-playwright-python)\n- [AWS ECR](https://gallery.ecr.aws/j9p6g6v0/lambda-playwright-python)\n\n## Features\n\n- Python 3.13 support with latest performance improvements\n- Playwright with headless Chromium browser\n- AWS Lambda ARM64 compatibility\n- Optimized for serverless environments\n- Minimal dependencies for Chromium only\n- Uses AWS Lambda's microdnf package manager\n- Enhanced type system and better type checking\n- Improved memory management and performance\n- VS Code dev container support with development tools\n\n## Development Setup\n\n### Prerequisites\n\n- Docker\n- VS Code with Remote - Containers extension\n- AWS CLI (for ECR deployment)\n- Python 3.13+\n\n### VS Code Dev Container\n\nThis project includes a VS Code dev container configuration that provides:\n\n- Git for version control\n- Python development tools\n- All necessary VS Code extensions\n- Pre-configured testing environment\n\nTo use the dev container:\n\n1. Open the project in VS Code\n2. When prompted, click \"Reopen in Container\"\n   - Or use the Command Palette (F1) and select \"Dev Containers: Reopen in Container\"\n3. Note that this dev container does not appear to work in Windsurf and **VS Code is recommended**\n\n### Building Locally\n\n```bash\ndocker build -t lambda-playwright-python .\n```\n\n### Testing\n\n```bash\npytest tests/\n```\n\n## Usage as Base Image\n\n### Pulling the Base Image\n\n```bash\n# From DockerHub\ndocker pull sjw7444/lambda-playwright-python:latest\n\n# From AWS ECR\naws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/j9p6g6v0/lambda-playwright-python\ndocker pull public.ecr.aws/j9p6g6v0/lambda-playwright-python:latest\n```\n\n### Using as Base Image\n\nCreate a new Dockerfile in your project:\n\n```dockerfile\nFROM sjw7444/lambda-playwright-python:latest\n\n# Copy your Lambda function code\nCOPY your_lambda_function.py ${LAMBDA_TASK_ROOT}\n\n# Set the CMD to your handler\nCMD [ \"your_lambda_function.handler\" ]\n```\n\n### Example Lambda Function with Headless Chromium\n\n```python\nfrom playwright.sync_api import sync_playwright\n\ndef handler(event, context):\n    with sync_playwright() as p:\n        # Launch headless Chromium\n        browser = p.chromium.launch(headless=True)\n        page = browser.new_page()\n        \n        # Your automation code here\n        page.goto('https://example.com')\n        title = page.title()\n        \n        browser.close()\n        return {'statusCode': 200, 'body': title}\n```\n\n## Project Structure\n\n```txt\n.\n├── Dockerfile            # Base image Dockerfile (Chromium-only)\n├── .devcontainer/        # VS Code dev container configuration\n├── .github/              # GitHub Actions workflows\n├── .vscode/              # VS Code settings and extensions\n├── tests/                # Test files\n└── requirements.txt      # Python dependencies\n```\n\n## Deployment\n\nThe base image is automatically built and deployed to both DockerHub and AWS ECR Public when changes are pushed to the main branch.\n\n### Required Secrets\n\nTo use the deployment workflow, you need to set up the following secrets in your GitHub repository:\n\n- `AWS_ROLE_ARN`: AWS IAM role ARN for ECR access\n- `ECR_REPOSITORY`: Your ECR repository name\n- `DOCKERHUB_USERNAME`: Your DockerHub username\n- `DOCKERHUB_TOKEN`: Your DockerHub access token\n\n### AWS Permissions\n\nThe AWS IAM role needs the following permissions:\n\n- `ecr-public:GetAuthorizationToken`\n- `ecr-public:BatchCheckLayerAvailability`\n- `ecr-public:GetRepositoryPolicy`\n- `ecr-public:DescribeRepositories`\n- `ecr-public:InitiateLayerUpload`\n- `ecr-public:UploadLayerPart`\n- `ecr-public:CompleteLayerUpload`\n- `ecr-public:PutImage`\n\n## License\n\nMIT License\n\n## Contributing\n\n1. Fork the repository\n2. Create your feature branch\n3. Commit your changes\n4. Push to the branch\n5. Create a new Pull Request\n\n## Security\n\nThis repository is designed to be open source. All sensitive information is stored as GitHub secrets and not committed to the repository. If you find any security issues, please report them by creating an issue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjw7444%2Flambda-playwright-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsjw7444%2Flambda-playwright-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjw7444%2Flambda-playwright-python/lists"}