mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-27 23:35:01 +00:00
test_lambda_image_copies_full_import_closure caught this: importing the Historic EPC S3 repo drags datatypes/epc/domain/historic_epc_matching.py into the handler's init-time closure, and that reaches back into the legacy address matcher — backend/address2UPRN/scoring.py and utils/pandas_utils.py. The image COPYed neither, so the Lambda would have died at cold start with Runtime.ImportModuleError. Copied file-by-file rather than `COPY backend/ backend/`: backend/ is the whole legacy engine and the closure needs only these seven files. Their third-party deps (pandas, requests) are already in requirements.txt, so no new pip installs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
37 lines
1.5 KiB
Docker
37 lines
1.5 KiB
Docker
FROM public.ecr.aws/lambda/python:3.11
|
|
|
|
WORKDIR /var/task
|
|
|
|
COPY applications/modelling_e2e/requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
COPY datatypes/ datatypes/
|
|
COPY domain/ domain/
|
|
COPY infrastructure/ infrastructure/
|
|
COPY orchestration/ orchestration/
|
|
COPY repositories/ repositories/
|
|
COPY utilities/ utilities/
|
|
COPY harness/ harness/
|
|
|
|
# harness/console.py imports in-memory fakes from tests/orchestration/ at module
|
|
# load time; the fakes have no pytest dependency and are safe to ship.
|
|
COPY tests/__init__.py tests/__init__.py
|
|
COPY tests/orchestration/__init__.py tests/orchestration/__init__.py
|
|
COPY tests/orchestration/fakes.py tests/orchestration/fakes.py
|
|
|
|
# The Historic EPC S3 repo (ADR-0054) maps shard rows through
|
|
# datatypes/epc/domain/historic_epc_matching.py, which reaches back into the
|
|
# legacy address matcher. Copied file-by-file rather than `COPY backend/ backend/`
|
|
# — backend/ is the whole legacy engine, and the closure needs only these. Their
|
|
# third-party deps (pandas, requests) are already in requirements.txt.
|
|
COPY utils/__init__.py utils/__init__.py
|
|
COPY utils/pandas_utils.py utils/pandas_utils.py
|
|
COPY backend/__init__.py backend/__init__.py
|
|
COPY backend/utils/__init__.py backend/utils/__init__.py
|
|
COPY backend/utils/addressMatch.py backend/utils/addressMatch.py
|
|
COPY backend/address2UPRN/__init__.py backend/address2UPRN/__init__.py
|
|
COPY backend/address2UPRN/scoring.py backend/address2UPRN/scoring.py
|
|
|
|
COPY applications/ applications/
|
|
|
|
CMD ["applications.modelling_e2e.handler.handler"]
|