Skip to content

Commit b37b321

Browse files
Merge pull request #192 from umihico/2023-08-23-234449
PR:Version Updates Wed Aug 23 23:44:49 UTC 2023
2 parents 8ba0671 + 8d6020c commit b37b321

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

.github/workflows/auto-update.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,17 @@ jobs:
6060
MAJOR_VERSION=${{ steps.chromium-versions.outputs.MAJOR_VERSION }}
6161
DRIVER_VERSION=$(curl "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${MAJOR_VERSION}")
6262
echo "DRIVER_VERSION=${DRIVER_VERSION}" >> $GITHUB_OUTPUT
63+
- name: Update Selenium
64+
id: selenium-version
65+
run: |
66+
echo "SELENIUM_VERSION=$(curl -s https://pypi.org/pypi/selenium/json | jq -r .info.version)" >> $GITHUB_OUTPUT
6367
- name: Update Dockerfile
6468
run: |
6569
SHA256_DIGEST=${{ steps.docker-image-digest.outputs.SHA256_DIGEST }}
6670
POSITION=${{ steps.chromium-versions.outputs.POSITION }}
6771
DRIVER_VERSION=${{ steps.chromedriver-version.outputs.DRIVER_VERSION }}
68-
sed -r "s/public.ecr.aws\/lambda\/python[:@a-z0-9]+/public.ecr.aws\/lambda\/python\@sha256\:${SHA256_DIGEST}/g; s/chromedriver.storage.googleapis.com\/[0-9.]+/chromedriver.storage.googleapis.com\/${DRIVER_VERSION}/g; s/Linux_x64%2F[0-9]+%2Fchrome-linux.zip/Linux_x64%2F${POSITION}%2Fchrome-linux.zip/g" -i Dockerfile
72+
SELENIUM_VERSION=${{ steps.selenium-version.outputs.SELENIUM_VERSION }}
73+
sed -r "s/public.ecr.aws\/lambda\/python[:@a-z0-9]+/public.ecr.aws\/lambda\/python\@sha256\:${SHA256_DIGEST}/g; s/chromedriver.storage.googleapis.com\/[0-9.]+/chromedriver.storage.googleapis.com\/${DRIVER_VERSION}/g; s/Linux_x64%2F[0-9]+%2Fchrome-linux.zip/Linux_x64%2F${POSITION}%2Fchrome-linux.zip/g; s/selenium==[0-9\.]*/selenium==${SELENIUM_VERSION}/g" -i Dockerfile
6974
- name: Deploy
7075
run: sls deploy
7176
env:
@@ -77,11 +82,6 @@ jobs:
7782
run: |
7883
CHROME_VERSION=$(docker run --rm --entrypoint '' serverless-docker-selenium-lambda-prod:img /opt/chrome/chrome --version | awk '{print $2}' | sed -e 's/^[[:space:]]*//')
7984
echo "CHROME_VERSION=${CHROME_VERSION}" >> $GITHUB_OUTPUT
80-
- name: Note selenium version
81-
id: selenium-version
82-
run: |
83-
SELENIUM_VERSION=$(docker run --rm --entrypoint '' serverless-docker-selenium-lambda-prod:img pip freeze | grep selenium | awk -F "==" '{print $2}')
84-
echo "SELENIUM_VERSION=${SELENIUM_VERSION}" >> $GITHUB_OUTPUT
8585
- name: Note python version
8686
id: python-version
8787
run: |

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
FROM public.ecr.aws/lambda/python@sha256:10dbb67ede15b5fd516be87dd71c3f7968904b0b840235720486476b34ef9b67 as build
1+
FROM public.ecr.aws/lambda/python@sha256:489d4abc8644060e2e16db2ffaaafa157359761feaf9438bf26ed88e37e43d9c as build
22
RUN yum install -y unzip && \
33
curl -Lo "/tmp/chromedriver.zip" "https://chromedriver.storage.googleapis.com/114.0.5735.90/chromedriver_linux64.zip" && \
44
curl -Lo "/tmp/chrome-linux.zip" "https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F1135561%2Fchrome-linux.zip?alt=media" && \
55
unzip /tmp/chromedriver.zip -d /opt/ && \
66
unzip /tmp/chrome-linux.zip -d /opt/
77

8-
FROM public.ecr.aws/lambda/python@sha256:10dbb67ede15b5fd516be87dd71c3f7968904b0b840235720486476b34ef9b67
8+
FROM public.ecr.aws/lambda/python@sha256:489d4abc8644060e2e16db2ffaaafa157359761feaf9438bf26ed88e37e43d9c
99
RUN yum install atk cups-libs gtk3 libXcomposite alsa-lib \
1010
libXcursor libXdamage libXext libXi libXrandr libXScrnSaver \
1111
libXtst pango at-spi2-atk libXt xorg-x11-server-Xvfb \
1212
xorg-x11-xauth dbus-glib dbus-glib-devel -y
13-
RUN pip install selenium==4.9.1
13+
RUN pip install selenium==4.11.2
1414
COPY --from=build /opt/chrome-linux /opt/chrome
1515
COPY --from=build /opt/chromedriver /opt/
1616
COPY main.py ./

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This image goes with these versions. [These are automatically updated and tested
1515
- Python 3.11.4
1616
- chromium 114.0.5735.0
1717
- chromedriver 114.0.5735.90
18-
- selenium 4.9.1
18+
- selenium 4.11.2
1919

2020
## Running the demo
2121

main.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
def handler(event=None, context=None):
77
options = webdriver.ChromeOptions()
8+
service = webdriver.ChromeService("/opt/chromedriver")
9+
810
options.binary_location = '/opt/chrome/chrome'
911
options.add_argument('--headless')
1012
options.add_argument('--no-sandbox')
@@ -18,7 +20,8 @@ def handler(event=None, context=None):
1820
options.add_argument(f"--data-path={mkdtemp()}")
1921
options.add_argument(f"--disk-cache-dir={mkdtemp()}")
2022
options.add_argument("--remote-debugging-port=9222")
21-
chrome = webdriver.Chrome("/opt/chromedriver",
22-
options=options)
23+
24+
chrome = webdriver.Chrome(options=options, service=service)
2325
chrome.get("https://example.com/")
26+
2427
return chrome.find_element(by=By.XPATH, value="//html").text

0 commit comments

Comments
 (0)