Dockerfile.client 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. # Copyright (c) 2019-2021 NVIDIA CORPORATION. All rights reserved.
  2. # Licensed under the Apache License, Version 2.0 (the "License");
  3. # you may not use this file except in compliance with the License.
  4. # You may obtain a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software
  9. # distributed under the License is distributed on an "AS IS" BASIS,
  10. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. # See the License for the specific language governing permissions and
  12. # limitations under the License.
  13. ARG TRITONSERVER_IMAGE=nvcr.io/nvidia/tritonserver:21.05-py3
  14. ARG KALDI_IMAGE=nvcr.io/nvidia/kaldi:21.08-py3
  15. ARG PYTHON_VER=3.8
  16. #
  17. # Kaldi shared library dependencies
  18. #
  19. FROM ${KALDI_IMAGE} as kaldi
  20. #
  21. # Builder image based on Triton Server SDK image
  22. #
  23. FROM ${TRITONSERVER_IMAGE}-sdk as builder
  24. ARG PYTHON_VER
  25. # Kaldi dependencies
  26. RUN set -eux; \
  27. apt-get update; \
  28. apt-get install -yq --no-install-recommends \
  29. automake \
  30. autoconf \
  31. cmake \
  32. flac \
  33. gawk \
  34. libatlas3-base \
  35. libtool \
  36. python${PYTHON_VER} \
  37. python${PYTHON_VER}-dev \
  38. sox \
  39. subversion \
  40. unzip \
  41. bc \
  42. libatlas-base-dev \
  43. gfortran \
  44. zlib1g-dev; \
  45. rm -rf /var/lib/apt/lists/*
  46. # Add Kaldi dependency
  47. COPY --from=kaldi /opt/kaldi /opt/kaldi
  48. # Set up Atlas
  49. RUN set -eux; \
  50. ln -sf /usr/include/x86_64-linux-gnu/atlas /usr/local/include/atlas; \
  51. ln -sf /usr/include/x86_64-linux-gnu/cblas.h /usr/local/include/cblas.h; \
  52. ln -sf /usr/include/x86_64-linux-gnu/clapack.h /usr/local/include/clapack.h; \
  53. ln -sf /usr/lib/x86_64-linux-gnu/atlas /usr/local/lib/atlas
  54. #
  55. # Triton Kaldi client build
  56. #
  57. FROM builder as client-build
  58. # Build the clients
  59. COPY kaldi-asr-client /workspace/triton-client
  60. RUN set -eux; \
  61. cd /workspace; \
  62. echo 'add_subdirectory(../../../triton-client src/c++/triton-client)' \
  63. >> /workspace/client/src/c++/CMakeLists.txt; \
  64. cmake -DCMAKE_BUILD_TYPE=Release -B build client; \
  65. cmake --build build --parallel --target cc-clients
  66. #
  67. # Final gRPC client image
  68. #
  69. FROM ${TRITONSERVER_IMAGE}
  70. ARG PYTHON_VER
  71. # Kaldi dependencies
  72. RUN set -eux; \
  73. apt-get update; \
  74. apt-get install -yq --no-install-recommends \
  75. automake \
  76. autoconf \
  77. cmake \
  78. flac \
  79. gawk \
  80. libatlas3-base \
  81. libtool \
  82. python${PYTHON_VER} \
  83. python${PYTHON_VER}-dev \
  84. sox \
  85. subversion \
  86. unzip \
  87. bc \
  88. libatlas-base-dev \
  89. zlib1g-dev; \
  90. rm -rf /var/lib/apt/lists/*
  91. # Add Kaldi dependency
  92. COPY --from=kaldi /opt/kaldi /opt/kaldi
  93. # Add Triton clients and scripts
  94. COPY --from=client-build /workspace/build/cc-clients/src/c++/triton-client/kaldi-asr-parallel-client /usr/local/bin/
  95. COPY scripts /workspace/scripts
  96. # Setup environment and entrypoint
  97. ENV LD_LIBRARY_PATH /opt/kaldi/src/lib/:/opt/tritonserver/lib:$LD_LIBRARY_PATH
  98. VOLUME /mnt/model-repo
  99. ENTRYPOINT ["/usr/local/bin/kaldi-asr-parallel-client"]