Model/applications/pashub_fetcher/handler/Dockerfile
Daniel Roth ae1da26558 Move the PasHub fetcher into the DDD layer structure 🟪
The service was the last one living wholly under backend/. It now follows
the same layering as abri and the other newer services:

  domain/pashub_fetcher/          core file classification, subfolders
  infrastructure/pashub_fetcher/  PasHub client, token getter, wire DTOs
  orchestration/                  PashubFetcherOrchestrator (was PashubService)
  applications/pashub_fetcher/    lambda handler, trigger request, dev tooling

core_files.py is split along the layer boundary: the domain module keeps the
filename/evidence-category classification rules and no longer imports
infrastructure.postgres, while the CoreFiles -> FileTypeEnum translation moves
to infrastructure/pashub_fetcher/core_file_types.py.

Tests move into the tests/ tree by layer. Note this puts them in the only
suite CI currently runs (unit_tests.yml is disabled), so these 73 tests now
execute on PRs for the first time; they were previously reachable only via
the legacy pytest.ini testpaths.

sharepoint_renamer's image now copies just domain/pashub_fetcher/ rather than
the whole service, since SharepointSubfolders is all it needed.

Behaviour is unchanged. tests/ goes 9927 -> 10000 passed (+73, exactly the
tests that moved in); the legacy suite keeps its same 17 pre-existing failures
and 11 errors. tests/test_lambda_packaging.py confirms both changed
Dockerfiles still copy their handler's full import closure.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 13:35:54 +00:00

40 lines
No EOL
1.7 KiB
Docker

# jammy (Ubuntu 22.04) ships Python 3.10, which lacks enum.StrEnum — used by
# domain/modelling/measure_type.py, which the handler pulls in transitively
# (handler -> pashub_fetcher_orchestrator -> documents_parser.parser -> ... -> domain).
# noble (Ubuntu 24.04) ships Python 3.12, matching the project's 3.11+ standard.
FROM mcr.microsoft.com/playwright/python:v1.58.0-noble
# Install AWS Lambda RIE
ADD https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie /usr/local/bin/aws-lambda-rie
RUN chmod +x /usr/local/bin/aws-lambda-rie
# Set working directory (Lambda task root)
WORKDIR /var/task
COPY utils/ utils/
COPY backend/ backend/
COPY datatypes/ datatypes/
# handler -> pashub_fetcher_orchestrator -> documents_parser.parser -> datatypes.epc.domain.mapper
# -> domain.sap10_calculator, and -> db_writer -> epc_property model
# -> infrastructure.postgres. Without these the lambda fails at init with
# "No module named 'domain'" / "'infrastructure'".
COPY domain/ domain/
COPY infrastructure/ infrastructure/
# The service now lives across the DDD layers: the handler is in applications/,
# PashubFetcherOrchestrator in orchestration/, the client in infrastructure/.
COPY applications/ applications/
COPY orchestration/ orchestration/
COPY applications/pashub_fetcher/handler/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Local lambda entrypoint
# ENTRYPOINT ["/usr/local/bin/aws-lambda-rie", "python", "-m", "awslambdaric"]
#AWS lambda entrypoint
ENTRYPOINT ["python", "-m", "awslambdaric"]
# -----------------------------
# Lambda handler
# -----------------------------
CMD ["applications.pashub_fetcher.handler.handler"]