THRIFT-3910 Do not invoke pip as part of build process

This closes #1073
diff --git a/build/docker/centos/Dockerfile b/build/docker/centos/Dockerfile
index f544a24..a31492b 100644
--- a/build/docker/centos/Dockerfile
+++ b/build/docker/centos/Dockerfile
@@ -56,9 +56,11 @@
 # Python Dependencies
 RUN yum install -y \
       python-devel \
+      python-pip \
       python-setuptools \
-      python-twisted-web \
-      python-pip
+      python-six \
+      python-twisted-web && \
+    pip install -U backports.ssl_match_hostname ipaddress tornado
 
 # Ruby Dependencies
 RUN yum install -y \
diff --git a/build/docker/centos6/Dockerfile b/build/docker/centos6/Dockerfile
index d0dc51a..4df75de 100644
--- a/build/docker/centos6/Dockerfile
+++ b/build/docker/centos6/Dockerfile
@@ -40,6 +40,9 @@
       python-pip \
     && yum clean all
 
+# optional dependencies
+RUN pip install ipaddress backports.ssl_match_hostname tornado
+
 # CMake
 RUN curl -sSL https://cmake.org/files/v3.4/cmake-3.4.1.tar.gz | tar -xz && \
     cd cmake-3.4.1 && ./bootstrap && make -j4 && make install && \
diff --git a/build/docker/debian/Dockerfile b/build/docker/debian/Dockerfile
index 22dd3b5..285c85b 100644
--- a/build/docker/debian/Dockerfile
+++ b/build/docker/debian/Dockerfile
@@ -145,6 +145,10 @@
 # Ruby
 RUN gem install bundler --no-ri --no-rdoc
 
+# Python optional dependencies
+RUN pip2 install -U ipaddress backports.ssl_match_hostname tornado
+RUN pip3 install -U backports.ssl_match_hostname tornado
+
 # Go
 RUN curl -sSL https://storage.googleapis.com/golang/go1.4.3.linux-amd64.tar.gz | tar -C /usr/local/ -xz
 ENV PATH /usr/local/go/bin:$PATH
diff --git a/build/docker/ubuntu/Dockerfile b/build/docker/ubuntu/Dockerfile
index 99f0a8f..2797a1c 100644
--- a/build/docker/ubuntu/Dockerfile
+++ b/build/docker/ubuntu/Dockerfile
@@ -163,6 +163,10 @@
 # Ruby
 RUN gem install bundler --no-ri --no-rdoc
 
+# Python optional dependencies
+RUN pip2 install -U ipaddress backports.ssl_match_hostname tornado
+RUN pip3 install -U backports.ssl_match_hostname tornado
+
 # Go
 RUN curl -sSL https://storage.googleapis.com/golang/go1.4.3.linux-amd64.tar.gz | tar -C /usr/local/ -xz
 ENV PATH /usr/local/go/bin:$PATH