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/ordnanceSurvey/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/

# Lambda handler
CMD ["backend/ordnanceSurvey/main.handler"]

