Files
lambda_local_runner/ctrl/Dockerfile.lambda

29 lines
1.0 KiB
Docker

FROM python:3.13-slim
WORKDIR /app
# Function-specific deps first. Each function carries its own requirements.txt
# (so a real AWS deploy zips the function folder verbatim). Locally, the pod
# installs the union of all of them.
COPY functions/ ./functions/
RUN set -e; \
for r in functions/*/requirements.txt; do \
[ -f "$r" ] && pip install --no-cache-dir -r "$r"; \
done
# Runner deps (FastAPI + uvicorn). Lives only in the runner pod; NOT bundled
# with any function zip for AWS.
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Shared modules (Lambda-Layer equivalent) and generic tooling.
COPY shared/ ./shared/
COPY invoke.py runner.py ./
# uvicorn --reload restarts on .py change → every code edit produces a fresh
# cold start, matching how AWS Lambda's container lifecycle works when you
# redeploy. Watching the whole /app tree picks up function-folder edits too.
CMD ["uvicorn", "runner:app", \
"--host", "0.0.0.0", "--port", "8000", \
"--reload", "--reload-dir", "/app"]