#FROM .dkr.ecr.us-east-1.amazonaws.com/serverless-ml-model-monitor:latest AS layer # Pull the base image with python 3.8 as a runtime for your Lambda FROM public.ecr.aws/lambda/python:3.8 # Layer code #WORKDIR /opt #COPY --from=layer /opt/ . # Function code WORKDIR /var/task # Load the BERT model from Huggingface and store it in the model directory RUN mkdir model RUN curl -L https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/pytorch_model.bin -o ./model/pytorch_model.bin RUN curl https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/config.json -o ./model/config.json RUN curl https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/tokenizer.json -o ./model/tokenizer.json RUN curl https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/tokenizer_config.json -o ./model/tokenizer_config.json # Copy the earlier created requirements.txt file to the container COPY requirements.txt ./ # Install the python requirements from requirements.txt RUN python3.8 -m pip install -r requirements.txt # Copy the earlier created app.py file to the container # Copy the timer helper class COPY app.py ./ COPY monitor.py ./ # Set the CMD to your handler CMD ["app.lambda_handler"]