-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile-lambda
More file actions
28 lines (20 loc) · 1.07 KB
/
Dockerfile-lambda
File metadata and controls
28 lines (20 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
ARG PYTHON_VERSION=3.12
FROM public.ecr.aws/lambda/python:$PYTHON_VERSION
ARG PLAYWRIGHT_VERSION=1.49.1
# Install Xvfb and dependencies
RUN dnf -y update && dnf -y install libpq-devel python3-devel gcc gcc-c++ make libXScrnSaver gtk3 alsa-lib.x86_64
# Install Playwright and dependencies
ENV PLAYWRIGHT_BROWSERS_PATH="/var/task/bin"
RUN python3.12 -m pip install --upgrade pip && \
python3.12 -m pip install --no-cache-dir playwright==${PLAYWRIGHT_VERSION} && \
mkdir -p $PLAYWRIGHT_BROWSERS_PATH && \
python3.12 -m playwright install chromium --with-deps
# Application part; install requirements
COPY requirements.txt /tmp/requirements.txt
COPY requirements_aws.txt /tmp/requirements_aws.txt
RUN python3.12 -m pip install --no-cache-dir -r /tmp/requirements.txt -r /tmp/requirements_aws.txt
COPY lambda_function.py /api-uni/lambda_function.py
COPY app /api-uni/app
WORKDIR /api-uni
EXPOSE 8000
ENTRYPOINT ["sh", "-c", "xvfb-run -a --server-args='-screen 0 1920x1080x24 -ac -nolisten tcp -nolisten unix' exec /usr/local/bin/python -m awslambdaric lambda_function.handler"]