Skip to content

Commit 150e030

Browse files
committed
Initial commit
0 parents  commit 150e030

File tree

16 files changed

+696
-0
lines changed

16 files changed

+696
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "Lambda Playwright Python",
3+
"build": {
4+
"dockerfile": "../Dockerfile",
5+
"context": ".."
6+
},
7+
"features": {
8+
"ghcr.io/devcontainers/features/git:1": {}
9+
},
10+
"customizations": {
11+
"vscode": {
12+
"extensions": [
13+
"ms-python.python",
14+
"ms-python.vscode-pylance",
15+
"ms-azuretools.vscode-docker",
16+
"ms-python.black-formatter",
17+
"ms-python.flake8",
18+
"ms-python.pylint",
19+
"njpwerner.autodocstring",
20+
"kevinrose.vsc-python-indent",
21+
"visualstudioexptteam.vscodeintellicode",
22+
"ev.container-lambda-playwright-python",
23+
"github.vscode-github-actions"
24+
],
25+
"settings": {
26+
"python.defaultInterpreterPath": "/usr/local/bin/python",
27+
"python.testing.pytestEnabled": true,
28+
"python.testing.unittestEnabled": false,
29+
"python.testing.nosetestsEnabled": false,
30+
"python.testing.pytestArgs": [
31+
"tests"
32+
]
33+
}
34+
}
35+
},
36+
"forwardPorts": [
37+
5678
38+
],
39+
"postCreateCommand": "pip install -r requirements.txt",
40+
"remoteUser": "root"
41+
}

.github/workflows/deploy.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Deploy Docker Image
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
AWS_REGION: us-east-1
11+
ECR_REPOSITORY: j9p6g6v0/lambda-playwright-python
12+
IMAGE_TAG: 0.1.${{ github.run_number }}
13+
14+
jobs:
15+
build-and-push:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v3
20+
21+
- name: Configure AWS Credentials
22+
uses: aws-actions/configure-aws-credentials@v4
23+
with:
24+
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
25+
role-session-name: deployrolesession
26+
aws-region: ${{ env.AWS_REGION }}
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v2
30+
with:
31+
driver: docker
32+
platforms: linux/arm64
33+
34+
- name: Login to DockerHub
35+
uses: docker/login-action@v2
36+
with:
37+
username: ${{ secrets.DOCKERHUB_USERNAME }}
38+
password: ${{ secrets.DOCKERHUB_TOKEN }}
39+
40+
- name: Login to Amazon ECR Public
41+
id: login-ecr
42+
uses: aws-actions/amazon-ecr-login@v1
43+
44+
- name: Build and push to DockerHub
45+
uses: docker/build-push-action@v4
46+
with:
47+
context: .
48+
push: true
49+
tags: |
50+
${{ secrets.DOCKERHUB_USERNAME }}/lambda-playwright-python:latest
51+
${{ secrets.DOCKERHUB_USERNAME }}/lambda-playwright-python:${{ github.sha }}
52+
${{ secrets.DOCKERHUB_USERNAME }}/lambda-playwright-python:v${{ env.IMAGE_TAG }}
53+
54+
- name: Build and push to Amazon ECR Public
55+
uses: docker/build-push-action@v4
56+
with:
57+
context: .
58+
push: true
59+
tags: |
60+
public.ecr.aws/${{ env.ECR_REPOSITORY }}:latest
61+
public.ecr.aws/${{ env.ECR_REPOSITORY }}:${{ github.sha }}
62+
platforms: linux/arm64
63+
64+
- name: Create Release
65+
uses: ncipollo/release-action@v1
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
with:
69+
tag: v${{ env.IMAGE_TAG }}
70+
name: Release v${{ env.IMAGE_TAG }}
71+
body: ${{ github.event.head_commit.message }}

.gitignore

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
build/
8+
develop-eggs/
9+
dist/
10+
downloads/
11+
eggs/
12+
.eggs/
13+
lib/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
*.egg-info/
20+
.installed.cfg
21+
*.egg
22+
23+
# Virtual Environment
24+
venv/
25+
ENV/
26+
env/
27+
.venv/
28+
29+
# IDE
30+
.idea/
31+
#.vscode/ # Let's be nice to the devs
32+
*.swp
33+
*.swo
34+
35+
# Docker
36+
.docker/
37+
38+
# Logs
39+
*.log
40+
41+
# Local development
42+
.env
43+
.env.local

.vscode/extensions.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"recommendations": [
3+
"ms-python.python",
4+
"ms-python.vscode-pylance",
5+
"ms-azuretools.vscode-docker",
6+
"ms-python.black-formatter",
7+
"ms-python.flake8",
8+
"ms-python.pylint",
9+
"njpwerner.autodocstring",
10+
"kevinrose.vsc-python-indent",
11+
"visualstudioexptteam.vscodeintellicode",
12+
"ev.container-lambda-playwright-python"
13+
]
14+
}

.vscode/launch.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Run Tests",
6+
"type": "debugpy",
7+
"request": "launch",
8+
"module": "pytest",
9+
"args": [
10+
"tests/",
11+
"-v"
12+
],
13+
"console": "integratedTerminal",
14+
"justMyCode": false
15+
}
16+
]
17+
}

.vscode/settings.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
3+
"editor.formatOnSave": true,
4+
"editor.rulers": [
5+
100
6+
],
7+
"files.exclude": {
8+
"**/__pycache__": true,
9+
"**/.pytest_cache": true,
10+
"**/*.pyc": true
11+
},
12+
"[python]": {
13+
"editor.defaultFormatter": "ms-python.black-formatter",
14+
"editor.formatOnSave": true,
15+
"editor.codeActionsOnSave": {
16+
"source.organizeImports": "explicit"
17+
}
18+
},
19+
"[dockerfile]": {
20+
"editor.defaultFormatter": "ms-azuretools.vscode-docker"
21+
},
22+
"python.analysis.typeCheckingMode": "basic",
23+
"python.analysis.autoImportCompletions": true,
24+
"python.analysis.extraPaths": [
25+
"${workspaceFolder}"
26+
],
27+
"python.testing.pytestEnabled": true,
28+
"python.testing.unittestEnabled": false,
29+
"python.testing.nosetestsEnabled": false,
30+
"python.testing.pytestArgs": [
31+
"tests"
32+
],
33+
"python.testing.autoTestDiscoverOnSaveEnabled": true,
34+
"python.testing.debugPort": 5678,
35+
"docker.enableTelemetry": false,
36+
"docker.showStartPage": false,
37+
"docker.initializeOnStartup": true,
38+
"docker.composePath": "docker-compose",
39+
"docker.defaultRegistryPath": "sjw7444",
40+
"docker.defaultImageTag": "latest",
41+
"docker.defaultContextPath": "${workspaceFolder}",
42+
"docker.defaultPlatform": "linux/arm64",
43+
"docker.containers.description": {
44+
"lambda-playwright": "Playwright Python Lambda Base Image"
45+
}
46+
}

CODE_OF_CONDUCT.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or
47+
reject comments, commits, code, wiki edits, issues, and other contributions
48+
that are not aligned to this Code of Conduct, and will communicate reasons
49+
for moderation decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
56+
## Enforcement
57+
58+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
59+
reported to the community leaders responsible for enforcement. All complaints will be reviewed and investigated
60+
promptly and fairly.
61+
62+
All community leaders are obligated to respect the privacy and security of the
63+
reporter of any incident.
64+
65+
## Enforcement Guidelines
66+
67+
Community leaders will follow these Community Impact Guidelines in determining
68+
the consequences for any action they deem in violation of this Code of Conduct:
69+
70+
### 1. Correction
71+
72+
**Community Impact**: Use of inappropriate language or other behavior deemed
73+
unprofessional or unwelcome in the community.
74+
75+
**Consequence**: A private, written warning from community leaders, providing
76+
clarity around the nature of the violation and an explanation of why the
77+
behavior was inappropriate. A public apology may be requested.
78+
79+
### 2. Warning
80+
81+
**Community Impact**: A violation through a single incident or series
82+
of actions.
83+
84+
**Consequence**: A warning with consequences for continued behavior. No
85+
interaction with the people involved, including unsolicited interaction with
86+
those enforcing the Code of Conduct, for a specified period of time. This
87+
includes avoiding interactions in community spaces as well as external channels
88+
like social media. Violating these terms may lead to a temporary or
89+
permanent ban.
90+
91+
### 3. Temporary Ban
92+
93+
**Community Impact**: A serious violation of community standards, including
94+
sustained inappropriate behavior.
95+
96+
**Consequence**: A temporary ban from any sort of interaction or public
97+
communication with the community for a specified period of time. No public or
98+
private interaction with the people involved, including unsolicited interaction
99+
with those enforcing the Code of Conduct, is allowed during this period.
100+
Violating these terms may lead to a permanent ban.
101+
102+
### 4. Permanent Ban
103+
104+
**Community Impact**: Demonstrating a pattern of violation of community
105+
standards, including sustained inappropriate behavior, harassment of an
106+
individual, or aggression toward or disparagement of classes of individuals.
107+
108+
**Consequence**: A permanent ban from any sort of public interaction within
109+
the community.
110+
111+
## Attribution
112+
113+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
114+
version 2.0, available at
115+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
116+
117+
[homepage]: https://www.contributor-covenant.org
118+
119+
For answers to common questions about this code of conduct, see
120+
https://www.contributor-covenant.org/faq

0 commit comments

Comments
 (0)