Created
December 17, 2020 03:11
-
-
Save McKlayne/92b934bfe9306f7f24752852f0ce7510 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define function directory | |
ARG FUNCTION_DIR="/function" | |
FROM python:buster as build-image | |
# Install aws-lambda-cpp build dependencies | |
RUN apt-get update && \ | |
apt-get install -y \ | |
g++ \ | |
make \ | |
cmake \ | |
unzip \ | |
libcurl4-openssl-dev | |
# Include global arg in this stage of the build | |
ARG FUNCTION_DIR | |
# Create function directory | |
RUN mkdir -p ${FUNCTION_DIR} | |
# Copy function code | |
COPY /* ${FUNCTION_DIR} | |
# Install the runtime interface client | |
RUN pip install \ | |
--target ${FUNCTION_DIR} \ | |
awslambdaric \ | |
numpy \ | |
pandas \ | |
boto3 \ | |
datetime \ | |
xgboost \ | |
scikit-learn | |
# Multi-stage build: grab a fresh copy of the base image | |
FROM python:buster | |
# Include global arg in this stage of the build | |
ARG FUNCTION_DIR | |
# Set working directory to function root directory | |
WORKDIR ${FUNCTION_DIR} | |
# Copy in the build image dependencies | |
COPY --from=build-image ${FUNCTION_DIR} ${FUNCTION_DIR} | |
ENTRYPOINT [ "/usr/local/bin/python", "-m", "awslambdaric" ] | |
CMD [ "prediction.handler" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment