seanpedrickcase
commited on
Commit
•
a3ba5e2
1
Parent(s):
18fb7ec
Some more debugging. Added aws-lambda-adapter just in case that's useful in AWS Lambda
Browse files- Dockerfile +3 -0
- entrypoint_router.py +0 -1
- lambda_entrypoint.py +8 -5
Dockerfile
CHANGED
@@ -20,6 +20,9 @@ COPY lambda_entrypoint.py .
|
|
20 |
# Stage 2: Final runtime image
|
21 |
FROM public.ecr.aws/docker/library/python:3.11.9-slim-bookworm
|
22 |
|
|
|
|
|
|
|
23 |
# Install system dependencies. Need to specify -y for poppler to get it to install
|
24 |
RUN apt-get update \
|
25 |
&& apt-get install -y \
|
|
|
20 |
# Stage 2: Final runtime image
|
21 |
FROM public.ecr.aws/docker/library/python:3.11.9-slim-bookworm
|
22 |
|
23 |
+
# Install Lambda web adapter in case you want to run with with an AWS Lamba function URL (not essential if not using Lambda)
|
24 |
+
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.8.4 /lambda-adapter /opt/extensions/lambda-adapter
|
25 |
+
|
26 |
# Install system dependencies. Need to specify -y for poppler to get it to install
|
27 |
RUN apt-get update \
|
28 |
&& apt-get install -y \
|
entrypoint_router.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
import os
|
2 |
-
import subprocess
|
3 |
|
4 |
if __name__ == "__main__":
|
5 |
run_direct_mode = os.getenv("RUN_DIRECT_MODE", "0")
|
|
|
1 |
import os
|
|
|
2 |
|
3 |
if __name__ == "__main__":
|
4 |
run_direct_mode = os.getenv("RUN_DIRECT_MODE", "0")
|
lambda_entrypoint.py
CHANGED
@@ -4,11 +4,14 @@ import subprocess
|
|
4 |
|
5 |
print("In lambda_entrypoint function")
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
print("s3_client is:", s3_client
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
12 |
|
13 |
def download_file_from_s3(bucket_name, key, download_path):
|
14 |
"""Download a file from S3 to the local filesystem."""
|
|
|
4 |
|
5 |
print("In lambda_entrypoint function")
|
6 |
|
7 |
+
try:
|
8 |
+
s3_client = boto3.client("s3", region_name="eu-west-2")
|
9 |
+
print("s3_client is initialized:", s3_client)
|
10 |
+
except Exception as e:
|
11 |
+
print(f"Error initializing s3_client: {e}")
|
12 |
+
raise e
|
13 |
+
|
14 |
+
TMP_DIR = "/tmp/"
|
15 |
|
16 |
def download_file_from_s3(bucket_name, key, download_path):
|
17 |
"""Download a file from S3 to the local filesystem."""
|