Move lambda package building to public.ecr.aws/lambda/python for compatibility

This commit is contained in:
Mikhail f. Shiryaev 2023-05-31 23:56:39 +02:00
parent 0ddd53088d
commit b7c5fdab77
No known key found for this signature in database
GPG Key ID: 4B02ED204C7D93F4
2 changed files with 6 additions and 5 deletions

View File

@ -6,13 +6,14 @@ build-backend = "setuptools.build_meta"
name = "lambda_shared"
version = "0.0.1"
dependencies = [
"requests < 2.30",
"requests",
"urllib3 < 2"
]
[project.optional-dependencies]
token = [
"PyJWT",
"cryptography<38",
"cryptography",
]
dev = [
"boto3",

View File

@ -12,7 +12,7 @@ DRY_RUN=${DRY_RUN:-}
PY_VERSION=${PY_VERSION:-3.10}
PY_EXEC="python${PY_VERSION}"
# Image to build the lambda zip package
DOCKER_IMAGE="python:${PY_VERSION}-slim"
DOCKER_IMAGE="public.ecr.aws/lambda/python:${PY_VERSION}"
# Rename the_lambda_name directory to the-lambda-name lambda in AWS
LAMBDA_NAME=${DIR_NAME//_/-}
# The name of directory with lambda code
@ -23,9 +23,9 @@ cp app.py "$PACKAGE"
if [ -f requirements.txt ]; then
VENV=lambda-venv
rm -rf "$VENV" lambda-package.zip
docker run --rm --user="${UID}" -e HOME=/tmp \
docker run --rm --user="${UID}" -e HOME=/tmp --entrypoint=/bin/bash \
--volume="${WORKDIR}/..:/ci" --workdir="/ci/${DIR_NAME}" "${DOCKER_IMAGE}" \
/bin/bash -exc "
-exc "
'$PY_EXEC' -m venv '$VENV' &&
source '$VENV/bin/activate' &&
pip install -r requirements.txt