ARG         AWS_ACCOUNT=086679231553
ARG         PARENT_IMAGE_TAG=lambda-python313
FROM        ${AWS_ACCOUNT}.dkr.ecr.us-east-1.amazonaws.com/docker-parent-images:${PARENT_IMAGE_TAG}

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

USER        root
WORKDIR     /var/task

COPY        --from=public.ecr.aws/datadog/lambda-extension:76 /opt/. /opt/
COPY        requirements.txt ./

RUN         dnf install -y gcc && \
            pip install --upgrade pip setuptools && \
            pip install -r requirements.txt && \
            dnf clean all

COPY        correction_stage/ ./correction_stage
COPY        config.py ./
COPY        app.py ./

EXPOSE      8080
USER        worker

ENV         DD_LAMBDA_HANDLER=app.handler
CMD         [ "datadog_lambda.handler.handler" ]
