From e8ee80f2df5f79b164964a7baebb0a8f2230a8fd Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 9 May 2025 15:36:28 -0400 Subject: [PATCH] Refactor Dockerfile and Packer configuration: update paths for package installation and add explicit copy for template_automation --- Dockerfile | 14 +++++++++++--- packer.pkr.hcl | 3 +++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8ee59f5..e0013d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,25 @@ +# DEPRECATED: This Dockerfile is not used for deployment. +# Lambda container image is built using Packer (see packer.pkr.hcl) +# ---------------------------------------------------------------- +# Keeping this file for reference only + FROM public.ecr.aws/lambda/python:3.11 # Copy requirements first to leverage Docker cache COPY requirements.txt /tmp/ -RUN pip install --no-cache-dir -r /tmp/requirements.txt -t ${LAMBDA_TASK_ROOT} +RUN pip install --no-cache-dir -r /tmp/requirements.txt -t /var/task # Copy all code files for package installation COPY . /tmp/app/ # Install the package in development mode to make it available to Python -RUN pip install -e /tmp/app -t ${LAMBDA_TASK_ROOT} +RUN pip install -e /tmp/app -t /var/task + +# Explicitly copy the template_automation package to the Lambda task root +COPY template_automation /var/task/template_automation/ # Copy the root app.py file (this is essential for AWS Lambda to find the handler) -COPY app.py ${LAMBDA_TASK_ROOT}/ +COPY app.py /var/task/ # Ensure the Lambda handler is correctly set CMD [ "app.lambda_handler" ] diff --git a/packer.pkr.hcl b/packer.pkr.hcl index 644d001..36e4277 100644 --- a/packer.pkr.hcl +++ b/packer.pkr.hcl @@ -59,6 +59,9 @@ build { "echo '=== Copying app.py to task root ==='", "cp /tmp/app.py /var/task/", + "echo '=== Explicitly copying template_automation package directory ==='", + "cp -r /tmp/template_automation /var/task/", + "echo '=== Listing installed Python packages ==='", "pip3 list",