File tree 3 files changed +17
-11
lines changed
3 files changed +17
-11
lines changed Original file line number Diff line number Diff line change 1
1
FROM public.ecr.aws/lambda/python:3.9 as build
2
2
RUN yum install -y unzip && \
3
- curl -SL https://chromedriver.storage.googleapis.com/2.43 /chromedriver_linux64.zip > /tmp/chromedriver.zip && \
4
- curl -SL https://github. com/adieuadieu/serverless-chrome/releases/ download/v1.0.0-55/stable-headless- chromium-amazonlinux-2017-03.zip > /tmp/headless-chromium .zip && \
3
+ curl -Lo "/tmp/chromedriver.zip" " https://chromedriver.storage.googleapis.com/89.0.4389.23 /chromedriver_linux64.zip" && \
4
+ curl -Lo "/tmp/chrome-linux.zip" " https://www.googleapis. com/download/storage/v1/b/ chromium-browser-snapshots/o/Linux_x64%2F843831%2Fchrome-linux .zip?alt=media" && \
5
5
unzip /tmp/chromedriver.zip -d /opt/ && \
6
- unzip /tmp/headless-chromium .zip -d /opt/
6
+ unzip /tmp/chrome-linux .zip -d /opt/
7
7
8
8
FROM public.ecr.aws/lambda/python:3.9
9
- RUN yum install -y https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
9
+ RUN yum install atk cups-libs gtk3 libXcomposite alsa-lib \
10
+ libXcursor libXdamage libXext libXi libXrandr libXScrnSaver \
11
+ libXtst pango at-spi2-atk libXt xorg-x11-server-Xvfb \
12
+ xorg-x11-xauth dbus-glib dbus-glib-devel -y
10
13
RUN pip install selenium
11
- COPY --from=build /opt/headless-chromium /opt/
14
+ COPY --from=build /opt/chrome-linux /opt/chrome
12
15
COPY --from=build /opt/chromedriver /opt/
13
16
COPY test.py ./
14
17
CMD [ "test.handler" ]
Original file line number Diff line number Diff line change @@ -5,10 +5,9 @@ This is minimum demo of headless chrome and selenium on container image on AWS L
5
5
This image goes with these versions.
6
6
7
7
- Python 3.9
8
- - serverless-chrome v1.0.0-55
9
- - chromium 69.0.3497.81 (stable channel) for amazonlinux:2017.03
10
- - chromedriver 2.43
11
- - selenium 3.141.0 (latest)
8
+ - chromium 89.0.4389.47
9
+ - chromedriver 89.0.4389.23
10
+ - selenium 4.0.0
12
11
13
12
### Running the demo
14
13
Original file line number Diff line number Diff line change 3
3
4
4
def handler (event = None , context = None ):
5
5
options = webdriver .ChromeOptions ()
6
- options .binary_location = " /opt/headless-chromium"
6
+ options .binary_location = ' /opt/chrome/chrome'
7
7
options .add_argument ('--headless' )
8
8
options .add_argument ('--no-sandbox' )
9
9
options .add_argument ("--disable-gpu" )
10
10
options .add_argument ("--window-size=1280x1696" )
11
11
options .add_argument ("--single-process" )
12
12
options .add_argument ("--disable-dev-shm-usage" )
13
+ options .add_argument ("--disable-dev-tools" )
14
+ options .add_argument ("--no-zygote" )
15
+ options .add_argument ("--user-data-dir=/tmp/chrome-user-data" )
16
+ options .add_argument ("--remote-debugging-port=9222" )
13
17
chrome = webdriver .Chrome ("/opt/chromedriver" ,
14
18
options = options )
15
- chrome .get ("https://umihi.co /" )
19
+ chrome .get ("https://example.com /" )
16
20
return chrome .find_element_by_xpath ("//html" ).text
You can’t perform that action at this time.
0 commit comments