Skip to content

Commit

Permalink
test lambda container with entrypoint.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Dec 4, 2023
1 parent 811e7a8 commit 91ff4e2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions cdk-projects/s3lambda/entry_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
if [ -z "${AWS_LAMBDA_RUNTIME_API}" ]; then
exec /usr/local/bin/aws-lambda-rie /usr/bin/npx aws-lambda-ric
else
exec /usr/bin/npx aws-lambda-ric
fi
7 changes: 6 additions & 1 deletion cdk-projects/s3lambda/lambda/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM ghcr.io/pnnl/exago:exago-develop-x436raytwpfhkihapsbpto3jd3dpfyqg.spack
# Copy requirements.txt
#COPY requirements.txt ${LAMBDA_TASK_ROOT}

#Define lambda task root
ENV LAMBDA_TASK_ROOT /var/task
# Copy function code
RUN mkdir -p ${LAMBDA_TASK_ROOT}
COPY lambda_handler.py ${LAMBDA_TASK_ROOT}
ADD python_wrapper ${LAMBDA_TASK_ROOT}/python_wrapper

Expand All @@ -18,6 +20,9 @@ RUN apt-get -yqq update && apt-get -yqq upgrade \
RUN pip install --upgrade pip
#RUN pip install -r ${LAMBDA_TASK_ROOT}/requirements.txt
RUN pip install awslambdaric
# Make port 9000 available to the world outside this container
EXPOSE 9000
#ADD aws-lambda-rie /usr/local/bin/aws-lambda-rie
ENTRYPOINT ["python", "-m", "awslambdaric"]
ENV PYTHONPATH "${PYTHONPATH}:/usr/local/lib/python3.10/dist-packages"

Expand Down
2 changes: 1 addition & 1 deletion cdk-projects/s3lambda/lambda/lambda_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import boto3
import boto
import subprocess
import os
import exago
Expand Down

0 comments on commit 91ff4e2

Please sign in to comment.