|
| 1 | +# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. |
| 2 | +# |
| 3 | +# Redistribution and use in source and binary forms, with or without |
| 4 | +# modification, are permitted provided that the following conditions |
| 5 | +# are met: |
| 6 | +# * Redistributions of source code must retain the above copyright |
| 7 | +# notice, this list of conditions and the following disclaimer. |
| 8 | +# * Redistributions in binary form must reproduce the above copyright |
| 9 | +# notice, this list of conditions and the following disclaimer in the |
| 10 | +# documentation and/or other materials provided with the distribution. |
| 11 | +# * Neither the name of NVIDIA CORPORATION nor the names of its |
| 12 | +# contributors may be used to endorse or promote products derived |
| 13 | +# from this software without specific prior written permission. |
| 14 | +# |
| 15 | +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY |
| 16 | +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 17 | +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 18 | +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
| 19 | +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 20 | +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 21 | +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 22 | +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 23 | +# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 24 | +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 25 | +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | + |
| 27 | +# Default setting is building on nvidia/cuda:10.1-devel-ubuntu18.04 |
| 28 | +ARG BASE_IMAGE=nvidia/cuda:10.1-devel-ubuntu18.04 |
| 29 | + |
| 30 | +FROM ${BASE_IMAGE} |
| 31 | + |
| 32 | +# Default to use Python3. Allowed values are "2" and "3". |
| 33 | +ARG PYVER=3 |
| 34 | + |
| 35 | +# Ensure apt-get won't prompt for selecting options |
| 36 | +ENV DEBIAN_FRONTEND=noninteractive |
| 37 | +ENV PYVER=$PYVER |
| 38 | + |
| 39 | +RUN PYSFX=`[ "$PYVER" != "2" ] && echo "$PYVER" || echo ""` && \ |
| 40 | + apt-get update && \ |
| 41 | + apt-get install -y --no-install-recommends \ |
| 42 | + software-properties-common \ |
| 43 | + autoconf \ |
| 44 | + automake \ |
| 45 | + build-essential \ |
| 46 | + cmake \ |
| 47 | + curl \ |
| 48 | + git \ |
| 49 | + libopencv-dev \ |
| 50 | + libopencv-core-dev \ |
| 51 | + libssl-dev \ |
| 52 | + libtool \ |
| 53 | + pkg-config \ |
| 54 | + python${PYSFX} \ |
| 55 | + python${PYSFX}-pip \ |
| 56 | + python${PYSFX}-dev && \ |
| 57 | + pip${PYSFX} install --upgrade setuptools wheel |
| 58 | + |
| 59 | +RUN PYSFX=`[ "$PYVER" != "2" ] && echo "$PYVER" || echo ""` && \ |
| 60 | + pip${PYSFX} install --upgrade grpcio-tools |
| 61 | + |
| 62 | +# Build expects "python" executable (not python3). |
| 63 | +RUN rm -f /usr/bin/python && \ |
| 64 | + ln -s /usr/bin/python$PYVER /usr/bin/python |
| 65 | + |
| 66 | +# Build the client library and examples |
| 67 | +WORKDIR /workspace |
| 68 | +COPY VERSION . |
| 69 | +COPY build build |
| 70 | +COPY src/clients src/clients |
| 71 | +COPY src/core src/core |
| 72 | + |
| 73 | +RUN cd build && \ |
| 74 | + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/workspace/install && \ |
| 75 | + make -j16 trtis-clients |
| 76 | +RUN cd install && \ |
| 77 | + export VERSION=`cat /workspace/VERSION` && \ |
| 78 | + tar zcf /workspace/v$VERSION.clients.tar.gz * |
| 79 | + |
| 80 | +# For CI testing need to install a test script. |
| 81 | +COPY qa/L0_client_tar/test.sh /tmp/test.sh |
| 82 | + |
| 83 | +# Install an image needed by the quickstart and other documentation. |
| 84 | +COPY qa/images/mug.jpg images/mug.jpg |
| 85 | + |
| 86 | +# Install the dependencies needed to run the client examples. These |
| 87 | +# are not needed for building but including them allows this image to |
| 88 | +# be used to run the client examples. The special upgrade and handling |
| 89 | +# of pip is needed to get numpy to install correctly with python2 on |
| 90 | +# ubuntu 16.04. |
| 91 | +RUN python -m pip install --user --upgrade pip && \ |
| 92 | + python -m pip install --upgrade install/python/tensorrtserver-*.whl numpy pillow |
| 93 | + |
| 94 | +ENV PATH //workspace/install/bin:${PATH} |
| 95 | +ENV LD_LIBRARY_PATH /workspace/install/lib:${LD_LIBRARY_PATH} |
0 commit comments