Updated Dockerfile

* use python 3
* include git-lfs
* allow checkout from GitHub instead of local copy step
This commit is contained in:
Cem Philipp Freimoser 2019-04-28 11:37:44 +02:00 committed by GitHub
parent b240502de9
commit f5bb103f88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,17 +5,24 @@ FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04
# >> START Install base software # >> START Install base software
RUN apt-get update && apt-get install -y \
software-properties-common \
curl
RUN add-apt-repository ppa:git-core/ppa && \
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
# Get basic packages # Get basic packages
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \ build-essential \
curl \ curl \
wget \ wget \
git \ git \
python \ python3 \
python-dev \ python3-dev \
python-pip \ python3-pip \
python-wheel \ python3-wheel \
python-numpy \ python3-numpy \
libcurl3-dev \ libcurl3-dev \
ca-certificates \ ca-certificates \
gcc \ gcc \
@ -35,7 +42,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
openjdk-8-jdk \ openjdk-8-jdk \
bash-completion \ bash-completion \
g++ \ g++ \
unzip unzip \
git-lfs
RUN ln -s -f /usr/bin/python3 /usr/bin/python
# Install NCCL 2.2 # Install NCCL 2.2
RUN apt-get install -qq -y --allow-downgrades --allow-change-held-packages libnccl2=2.3.7-1+cuda10.0 libnccl-dev=2.3.7-1+cuda10.0 RUN apt-get install -qq -y --allow-downgrades --allow-change-held-packages libnccl2=2.3.7-1+cuda10.0 libnccl-dev=2.3.7-1+cuda10.0
@ -49,7 +59,7 @@ RUN apt-get install -qq -y cuda-command-line-tools-10-0
# Install pip # Install pip
RUN wget https://bootstrap.pypa.io/get-pip.py && \ RUN wget https://bootstrap.pypa.io/get-pip.py && \
python get-pip.py && \ python3 get-pip.py && \
rm get-pip.py rm get-pip.py
# << END Install base software # << END Install base software
@ -80,7 +90,7 @@ ENV TF_BUILD_CONTAINER_TYPE GPU
ENV TF_BUILD_OPTIONS OPT ENV TF_BUILD_OPTIONS OPT
ENV TF_BUILD_DISABLE_GCP 1 ENV TF_BUILD_DISABLE_GCP 1
ENV TF_BUILD_ENABLE_XLA 0 ENV TF_BUILD_ENABLE_XLA 0
ENV TF_BUILD_PYTHON_VERSION PYTHON2 ENV TF_BUILD_PYTHON_VERSION PYTHON3
ENV TF_BUILD_IS_OPT OPT ENV TF_BUILD_IS_OPT OPT
ENV TF_BUILD_IS_PIP PIP ENV TF_BUILD_IS_PIP PIP
@ -101,8 +111,8 @@ ENV TF_NEED_TENSORRT 0
ENV TF_NEED_GDR 0 ENV TF_NEED_GDR 0
ENV TF_NEED_VERBS 0 ENV TF_NEED_VERBS 0
ENV TF_NEED_OPENCL_SYCL 0 ENV TF_NEED_OPENCL_SYCL 0
ENV PYTHON_BIN_PATH /usr/bin/python2.7 ENV PYTHON_BIN_PATH /usr/bin/python3.6
ENV PYTHON_LIB_PATH /usr/lib/python2.7/dist-packages ENV PYTHON_LIB_PATH /usr/lib/python3.6/dist-packages
# << END Configure Tensorflow Build # << END Configure Tensorflow Build
@ -134,14 +144,15 @@ ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:/usr/local/cuda/extras/CUPTI/lib64:/usr/loc
# << END Configure Bazel # << END Configure Bazel
# Copy DeepSpeech repo contents to container's /DeepSpeech # Copy DeepSpeech repo contents to container's /DeepSpeech
COPY . /DeepSpeech/ COPY . /DeepSpeech/
# Alternative clone from GitHub
# WORKDIR /
# RUN git clone https://github.com/mozilla/DeepSpeech.git
WORKDIR /DeepSpeech WORKDIR /DeepSpeech
RUN pip --no-cache-dir install -r requirements.txt RUN pip3 --no-cache-dir install -r requirements.txt
# Link DeepSpeech native_client libs to tf folder # Link DeepSpeech native_client libs to tf folder
RUN ln -s /DeepSpeech/native_client /tensorflow RUN ln -s /DeepSpeech/native_client /tensorflow
@ -176,7 +187,7 @@ RUN bazel build --config=monolithic --config=cuda -c opt --copt=-O3 --copt="-D_G
# RUN bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg # RUN bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
# #
# # Install tensorflow from our custom wheel # # Install tensorflow from our custom wheel
# RUN pip install /tmp/tensorflow_pkg/*.whl # RUN pip3 install /tmp/tensorflow_pkg/*.whl
# Copy built libs to /DeepSpeech/native_client # Copy built libs to /DeepSpeech/native_client
RUN cp /tensorflow/bazel-bin/native_client/generate_trie /DeepSpeech/native_client/ \ RUN cp /tensorflow/bazel-bin/native_client/generate_trie /DeepSpeech/native_client/ \
@ -184,7 +195,7 @@ RUN cp /tensorflow/bazel-bin/native_client/generate_trie /DeepSpeech/native_clie
# Install TensorFlow # Install TensorFlow
WORKDIR /DeepSpeech/ WORKDIR /DeepSpeech/
RUN pip install tensorflow-gpu==1.13.1 RUN pip3 install tensorflow-gpu==1.13.1
# Make DeepSpeech and install Python bindings # Make DeepSpeech and install Python bindings
@ -193,10 +204,10 @@ WORKDIR /DeepSpeech/native_client
RUN make deepspeech RUN make deepspeech
WORKDIR /DeepSpeech/native_client/python WORKDIR /DeepSpeech/native_client/python
RUN make bindings RUN make bindings
RUN pip install dist/deepspeech* RUN pip3 install dist/deepspeech*
WORKDIR /DeepSpeech/native_client/ctcdecode WORKDIR /DeepSpeech/native_client/ctcdecode
RUN make RUN make
RUN pip install dist/*.whl RUN pip3 install dist/*.whl
# << END Build and bind # << END Build and bind