FROM python:3.11-slim-bookworm | |
# Include global arg in this stage of the build | |
ARG LAMBDA_TASK_ROOT="/var/task" | |
ARG PYTHONPATH="${LAMBDA_TASK_ROOT}:${PYTHONPATH}:/usr/local/lib/python3/dist-packages" | |
ARG RIE="https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie" | |
RUN echo "ENV RIE: $RIE ..." | |
# Set working directory to function root directory | |
WORKDIR ${LAMBDA_TASK_ROOT} | |
COPY requirements_pip.txt ${LAMBDA_TASK_ROOT}/requirements_pip.txt | |
COPY requirements.txt ${LAMBDA_TASK_ROOT}/requirements.txt | |
# avoid segment-geospatial exception caused by missing libGL.so.1 library | |
RUN apt update && apt install -y libgl1 curl python3-pip | |
RUN ls -ld /usr/lib/*linux-gnu/libGL.so* || echo "libGL.so* not found..." | |
RUN which python | |
RUN python --version | |
RUN python -m pip install -r ${LAMBDA_TASK_ROOT}/requirements_pip.txt --upgrade --target ${LAMBDA_TASK_ROOT} | |
RUN python -m pip install -r ${LAMBDA_TASK_ROOT}/requirements.txt --target ${LAMBDA_TASK_ROOT} | |
RUN python -c "import sys;print(sys.path)" | |
# RUN python -m pip install pillow awslambdaric aws-lambda-powertools httpx jmespath --target ${LAMBDA_TASK_ROOT} | |
RUN curl -Lo /usr/local/bin/aws-lambda-rie ${RIE} | |
RUN chmod +x /usr/local/bin/aws-lambda-rie | |
COPY ./scripts/lambda-entrypoint.sh /lambda-entrypoint.sh | |
RUN chmod +x /lambda-entrypoint.sh | |
RUN ls -l /lambda-entrypoint.sh | |
ENTRYPOINT ["/lambda-entrypoint.sh"] | |