@@ -62,15 +62,15 @@ RUN apt-get install -y gnupg zip openjdk-8-jdk && \
6262 dpkg -i bazel_*.deb && \
6363 rm bazel_*.deb
6464
65- # Fetch tensorflow & install dependencies.
65+ # Fetch TensorFlow & install dependencies.
6666RUN cd /usr/local/src && \
6767 git clone https://github.com/tensorflow/tensorflow && \
6868 cd tensorflow && \
6969 git checkout tags/v2.2.0 && \
7070 pip install keras_applications --no-deps && \
7171 pip install keras_preprocessing --no-deps
7272
73- # Create a tensorflow wheel for CPU
73+ # Create a TensorFlow wheel for CPU
7474RUN cd /usr/local/src/tensorflow && \
7575 cat /dev/null | ./configure && \
7676 bazel build --config=opt \
@@ -80,6 +80,26 @@ RUN cd /usr/local/src/tensorflow && \
8080 bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_cpu && \
8181 bazel clean
8282
83+ # Install TensorFlow CPU wheel which is required to build the GCS & addons libraries.
84+ RUN pip install /tmp/tensorflow_cpu/tensorflow*.whl
85+
86+ # Build TensorFlow addons library against TensorFlow CPU.
87+ RUN cd /usr/local/src/ && \
88+ git clone https://github.com/tensorflow/addons && \
89+ cd addons && \
90+ git checkout tags/v0.10.0 && \
91+ python ./configure.py && \
92+ bazel build --enable_runfiles build_pip_pkg && \
93+ bazel-bin/build_pip_pkg /tmp/tfa_cpu && \
94+ bazel clean
95+
96+ # Build tensorflow_gcs_config library against TensorFlow CPU.
97+ ADD tensorflow-gcs-config /usr/local/src/tensorflow_gcs_config/
98+ RUN cd /usr/local/src/tensorflow_gcs_config && \
99+ apt-get install -y libcurl4-openssl-dev && \
100+ python setup.py bdist_wheel -d /tmp/tensorflow_gcs_config && \
101+ bazel clean
102+
83103# Create a tensorflow wheel for GPU/cuda
84104ENV TF_NEED_CUDA=1
85105ENV TF_CUDA_VERSION=$CUDA_MAJOR_VERSION.$CUDA_MINOR_VERSION
@@ -103,13 +123,16 @@ RUN cd /usr/local/src/tensorflow && \
103123 bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_gpu && \
104124 bazel clean
105125
106- ADD tensorflow-gcs-config /usr/local/src/tensorflow_gcs_config/
126+ # Install TensorFlow GPU wheel which to build addons against.
127+ RUN pip install /tmp/tensorflow_gpu/tensorflow*.whl
107128
108- # Build tensorflow_gcs_config library against the tensorflow_cpu build
109- RUN cd /usr/local/src/tensorflow_gcs_config && \
110- apt-get install -y libcurl4-openssl-dev && \
111- pip install /tmp/tensorflow_cpu/tensorflow*.whl && \
112- python setup.py bdist_wheel -d /tmp/tensorflow_gcs_config && \
129+ # Build TensorFlow addons library against TensorFlow GPU.
130+ ENV CUDA_TOOLKIT_PATH=/usr/local/cuda
131+ ENV CUDNN_INSTALL_PATH=/usr/lib/x86_64-linux-gnu
132+ RUN cd /usr/local/src/addons && \
133+ python ./configure.py && \
134+ bazel build --enable_runfiles build_pip_pkg && \
135+ bazel-bin/build_pip_pkg /tmp/tfa_gpu && \
113136 bazel clean
114137
115138# Print out the built .whl files
0 commit comments