FROM 086679231553.dkr.ecr.us-east-1.amazonaws.com/docker-parent-images:lambda-python314

ARG version
LABEL Version=$version
ENV build_version=$version

COPY --from=public.ecr.aws/datadog/lambda-extension:latest /opt/. /opt/

RUN --mount=from=ghcr.io/astral-sh/uv:latest,source=/uv,target=/bin/uv \
    --mount=type=bind,source=uv.lock,target=uv.lock \
    --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
    uv export --frozen --no-emit-workspace --no-dev --no-editable -o requirements.txt && \
    uv pip install -r requirements.txt --system

# Copy the application code.
COPY app/ ./app

# Set the AWS Lambda handler.
ENV DD_LAMBDA_HANDLER=app.main.handle
CMD [ "datadog_lambda.handler.handler" ]
