FROM public.ecr.aws/lambda/python:3.11 ARG DEV_DB_HOST ARG DEV_DB_PORT ARG DEV_DB_NAME ENV DB_HOST=${DEV_DB_HOST} ENV DB_PORT=${DEV_DB_PORT} ENV DB_NAME=${DEV_DB_NAME} # Set working directory (Lambda task root) WORKDIR /var/task COPY backend/postcode_splitter/handler/requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy necessary files for database and utility imports COPY utils/ utils/ COPY backend/ backend/ COPY datatypes/ datatypes/ # backend.app.db.models.recommendations imports infrastructure.postgres.modelling, # which imports domain.modelling; without these the lambda fails at init with # "No module named 'infrastructure'" / "'domain'". COPY infrastructure/ infrastructure/ COPY domain/ domain/ # Copy the handler COPY backend/postcode_splitter/main.py . # Lambda handler CMD ["main.handler"]