FROM ubuntu:16.04 # Set a docker label to advertise multi-model support on the container LABEL com.amazonaws.sagemaker.capabilities.multi-models=true # Set a docker label to enable container to use SAGEMAKER_BIND_TO_PORT environment variable if present LABEL com.amazonaws.sagemaker.capabilities.accept-bind-to-port=true # Install necessary dependencies for MMS and SageMaker Inference Toolkit RUN apt-get update && \ apt-get -y install --no-install-recommends \ build-essential \ ca-certificates \ openjdk-8-jdk-headless \ curl RUN echo 'installing miniconda' && \ curl -LO http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \ bash Miniconda3-latest-Linux-x86_64.sh -bfp /miniconda3 && \ rm Miniconda3-latest-Linux-x86_64.sh ENV PATH=/miniconda3/bin:${PATH} RUN conda install python=3.6 && \ conda update -y conda && \ conda install -c conda-forge pyarrow=0.14.1 && \ conda install -c mlio -c conda-forge mlio-py=0.1 # Install latest version of sklearn RUN pip install --no-cache -I scikit-learn==0.20 # Install latest version of XGBoost RUN pip install --no-cache -I xgboost==0.90 # Install latest version of Tensorflow RUN pip install --no-cache -I tensorflow # Install MMS, and SageMaker Inference Toolkit to set up MMS RUN pip --no-cache-dir install multi-model-server \ sagemaker-inference \ retrying # Copy entrypoint script to the image COPY dockerd-entrypoint.py /usr/local/bin/dockerd-entrypoint.py RUN chmod +x /usr/local/bin/dockerd-entrypoint.py RUN mkdir -p /home/model-server/ # Copy the default custom service file to handle incoming data and inference requests COPY model_handler.py /home/model-server/model_handler.py # Define an entrypoint script for the docker image ENTRYPOINT ["python", "/usr/local/bin/dockerd-entrypoint.py"] # Define command to be passed to the entrypoint CMD ["serve"]