Skip to content

Commit

Permalink
Refactor Dockerfile and Packer configuration: update paths for packag…
Browse files Browse the repository at this point in the history
…e installation and add explicit copy for template_automation
  • Loading branch information
Your Name committed May 9, 2025
1 parent 7e7b867 commit e8ee80f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
3 changes: 3 additions & 0 deletions packer.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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",

Expand Down

0 comments on commit e8ee80f

Please sign in to comment.