FROM mcr.microsoft.com/playwright/python:v1.58.0-jammy

# 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 backend/ecmk_fetcher/handler/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY utils/ utils/
COPY backend/ backend/
COPY datatypes/ datatypes/

# Local lambda entrypoint 
# ENTRYPOINT ["/usr/local/bin/aws-lambda-rie", "python", "-m", "awslambdaric"]

#AWS lambda entrypoint
ENTRYPOINT ["python", "-m", "awslambdaric"]

# -----------------------------
# Lambda handler
# -----------------------------
CMD ["backend.ecmk_fetcher.handler.handler.handler"]