Dockerfile_default
1 # Build an image that can serve mlflow models. 2 FROM python:${{ PYTHON_VERSION }}-slim 3 4 RUN apt-get -y update && apt-get install -y --no-install-recommends nginx 5 6 7 8 WORKDIR /opt/mlflow 9 10 # Install MLflow 11 RUN pip install ${{ MLFLOW_INSTALL }} 12 13 # Copy model to image and install dependencies 14 COPY model_dir/model /opt/ml/model 15 RUN python -c "from mlflow.models import container as C; C._install_pyfunc_deps('/opt/ml/model', install_mlflow=False, enable_mlserver=False, env_manager='local');" 16 17 ENV MLFLOW_DISABLE_ENV_CREATION=True 18 ENV ENABLE_MLSERVER=False 19 20 # granting read/write access and conditional execution authority to all child directories 21 # and files to allow for deployment to AWS Sagemaker Serverless Endpoints 22 # (see https://docs.aws.amazon.com/sagemaker/latest/dg/serverless-endpoints.html) 23 RUN chmod o+rwX /opt/mlflow/ 24 25 # clean up apt cache to reduce image size 26 RUN rm -rf /var/lib/apt/lists/* 27 28 ENTRYPOINT ["python", "-c", "from mlflow.models import container as C; C._serve('local')"]