Skip to content

Commit 560fbca

Browse files
mvsuspyangaws
authored andcommitted
Add docker files of TF 1.12 (#139)
1 parent 1ee7c09 commit 560fbca

File tree

3 files changed

+163
-1
lines changed

3 files changed

+163
-1
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
FROM tensorflow/serving:1.12.0 as tensorflow_serving_image
2+
FROM ubuntu:16.04
3+
4+
LABEL maintainer="Amazon AI"
5+
LABEL com.amazonaws.sagemaker.capabilities.accept-bind-to-port=true
6+
7+
ARG framework_installable
8+
ARG framework_support_installable=sagemaker_tensorflow_container-1.0.0.tar.gz
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 --from=tensorflow_serving_image /usr/bin/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"]
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
FROM tensorflow/serving:1.12.0-gpu as tensorflow_serving_image
2+
FROM nvidia/cuda:9.0-base-ubuntu16.04
3+
4+
LABEL maintainer="Amazon AI"
5+
LABEL com.amazonaws.sagemaker.capabilities.accept-bind-to-port=true
6+
7+
ARG framework_installable
8+
ARG framework_support_installable=sagemaker_tensorflow_container-1.0.0.tar.gz
9+
10+
ENV NCCL_VERSION=2.3.5-2+cuda9.0
11+
ENV CUDNN_VERSION=7.3.1.20-1+cuda9.0
12+
ENV TF_TENSORRT_VERSION=4.1.2
13+
14+
RUN apt-get update && apt-get install -y --no-install-recommends \
15+
ca-certificates \
16+
cuda-command-line-tools-9-0 \
17+
cuda-cublas-9-0 \
18+
cuda-cufft-9-0 \
19+
cuda-curand-9-0 \
20+
cuda-cusolver-9-0 \
21+
cuda-cusparse-9-0 \
22+
libcudnn7=${CUDNN_VERSION} \
23+
libnccl2=${NCCL_VERSION} \
24+
libgomp1 \
25+
python \
26+
curl \
27+
nginx \
28+
&& \
29+
# The 'apt-get install' of nvinfer-runtime-trt-repo-ubuntu1604-4.0.1-ga-cuda9.0
30+
# adds a new list which contains libnvinfer library, so it needs another
31+
# 'apt-get update' to retrieve that list before it can actually install the
32+
# library.
33+
# We don't install libnvinfer-dev since we don't need to build against TensorRT,
34+
# and libnvinfer4 doesn't contain libnvinfer.a static library.
35+
apt-get update && apt-get install -y --no-install-recommends \
36+
nvinfer-runtime-trt-repo-ubuntu1604-4.0.1-ga-cuda9.0 && \
37+
apt-get update && apt-get install -y --no-install-recommends \
38+
libnvinfer4=${TF_TENSORRT_VERSION}-1+cuda9.0 && \
39+
apt-get clean && \
40+
rm -rf /var/lib/apt/lists/* && \
41+
rm /usr/lib/x86_64-linux-gnu/libnvinfer_plugin* && \
42+
rm /usr/lib/x86_64-linux-gnu/libnvcaffe_parser* && \
43+
rm /usr/lib/x86_64-linux-gnu/libnvparsers*
44+
45+
# Python won’t try to write .pyc or .pyo files on the import of source modules
46+
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
47+
48+
# Removing tests to free some space
49+
RUN set -ex; \
50+
curl -k -O https://bootstrap.pypa.io/get-pip.py && \
51+
python get-pip.py \
52+
--disable-pip-version-check \
53+
--no-cache-dir \
54+
"pip==18.1" \
55+
; \
56+
pip --version; \
57+
find /usr/local -depth \
58+
\( \
59+
\( -type d -a \( -name test -o -name tests \) \) \
60+
-o \
61+
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
62+
\) -exec rm -rf '{}' +; \
63+
rm -f get-pip.py
64+
65+
WORKDIR /
66+
67+
# Install TF Serving pkg
68+
COPY --from=tensorflow_serving_image /usr/bin/tensorflow_model_server /usr/bin/tensorflow_model_server
69+
70+
71+
COPY $framework_installable .
72+
COPY $framework_support_installable .
73+
74+
RUN pip install -U --no-cache-dir \
75+
numpy \
76+
scipy \
77+
sklearn \
78+
pandas \
79+
Pillow \
80+
h5py \
81+
tensorflow-serving-api==1.12.0 \
82+
\
83+
$framework_installable \
84+
$framework_support_installable \
85+
"sagemaker-tensorflow>=1.12,<1.13" && \
86+
\
87+
rm $framework_installable && \
88+
rm $framework_support_installable && \
89+
pip uninstall -y --no-cache-dir \
90+
markdown \
91+
tensorboard
92+
93+
# entry.py comes from sagemaker-container-support
94+
ENTRYPOINT ["entry.py"]

test/integ/test_versions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def required_versions(framework_version):
2323
elif framework_version == '1.5.0':
2424
return ['tensorflow-serving-api==1.5.0',
2525
'tensorflow==1.5.0']
26-
# We released using tensorflow serving 1.5.0 for tf 1.6, due to not finding this
26+
# We released using TensorFlow Serving 1.5.0 for tf 1.6, due to not finding this
2727
# fix in time before launch: https://github.com/tensorflow/serving/issues/819
2828
elif framework_version == '1.6.0':
2929
return ['tensorflow-serving-api==1.5.0',
@@ -44,6 +44,9 @@ def required_versions(framework_version):
4444
elif framework_version == '1.11.0':
4545
return ['tensorflow-serving-api==1.11.0',
4646
'tensorflow==1.11.0']
47+
elif framework_version == '1.12.0':
48+
return ['tensorflow-serving-api==1.12.0',
49+
'tensorflow==1.12.0']
4750
else:
4851
raise ValueError("invalid internal test config")
4952

0 commit comments

Comments
 (0)