|
| 1 | +FROM ubuntu:16.04 |
| 2 | + |
| 3 | +LABEL maintainer="Amazon AI" |
| 4 | +LABEL com.amazonaws.sagemaker.capabilities.accept-bind-to-port=true |
| 5 | + |
| 6 | +ARG framework_installable |
| 7 | +ARG framework_support_installable=sagemaker_tensorflow_container-1.0.0.tar.gz |
| 8 | +ARG tensorflow_model_server |
| 9 | + |
| 10 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 11 | + ca-certificates \ |
| 12 | + python \ |
| 13 | + curl \ |
| 14 | + nginx \ |
| 15 | + && rm -rf /var/lib/apt/lists/* |
| 16 | + |
| 17 | +# Python won’t try to write .pyc or .pyo files on the import of source modules |
| 18 | +ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 |
| 19 | + |
| 20 | +# Removing tests to free some space |
| 21 | +RUN set -ex; \ |
| 22 | + curl -k -O https://bootstrap.pypa.io/get-pip.py && \ |
| 23 | + python get-pip.py \ |
| 24 | + --disable-pip-version-check \ |
| 25 | + --no-cache-dir \ |
| 26 | + "pip==18.1" \ |
| 27 | + ; \ |
| 28 | + pip --version; \ |
| 29 | + find /usr/local -depth \ |
| 30 | + \( \ |
| 31 | + \( -type d -a \( -name test -o -name tests \) \) \ |
| 32 | + -o \ |
| 33 | + \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ |
| 34 | + \) -exec rm -rf '{}' +; \ |
| 35 | + rm -f get-pip.py |
| 36 | + |
| 37 | +WORKDIR / |
| 38 | + |
| 39 | +# Install TF Serving pkg |
| 40 | +COPY $tensorflow_model_server /usr/bin/tensorflow_model_server |
| 41 | + |
| 42 | +COPY $framework_installable . |
| 43 | +COPY $framework_support_installable . |
| 44 | + |
| 45 | +RUN pip install -U --no-cache-dir \ |
| 46 | + numpy \ |
| 47 | + scipy \ |
| 48 | + sklearn \ |
| 49 | + pandas \ |
| 50 | + Pillow \ |
| 51 | + h5py \ |
| 52 | + tensorflow-serving-api==1.12.0 \ |
| 53 | + \ |
| 54 | + $framework_installable \ |
| 55 | + $framework_support_installable \ |
| 56 | + "sagemaker-tensorflow>=1.12,<1.13" && \ |
| 57 | + \ |
| 58 | + rm $framework_installable && \ |
| 59 | + rm $framework_support_installable && \ |
| 60 | + pip uninstall -y --no-cache-dir \ |
| 61 | + markdown \ |
| 62 | + tensorboard |
| 63 | + |
| 64 | +# entry.py comes from sagemaker-container-support |
| 65 | +ENTRYPOINT ["entry.py"] |
0 commit comments