Skip to content

Instantly share code, notes, and snippets.

@Alex-Wauters
Created October 24, 2019 12:05
Show Gist options
  • Save Alex-Wauters/bd7f7a781c1f5e95849690a7f9fa653a to your computer and use it in GitHub Desktop.
Save Alex-Wauters/bd7f7a781c1f5e95849690a7f9fa653a to your computer and use it in GitHub Desktop.
Dockerfile for computer vision scripts (parking vision case)
FROM tensorflow/tensorflow:1.13.1-py3
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
git \
wget \
unzip \
yasm \
pkg-config \
libswscale-dev \
libsm6 \
libxext6 \
libxrender-dev \
libtbb2 \
libtbb-dev \
libjpeg-dev \
libpng-dev \
libtiff-dev \
libjasper-dev \
libavformat-dev \
libhdf5-dev \
libpq-dev
# Python dependencies
RUN pip3 --no-cache-dir install \
numpy \
hdf5storage \
h5py \
scipy \
py3nvml
WORKDIR /
ENV OPENCV_VERSION="3.4.6"
RUN wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip \
&& unzip ${OPENCV_VERSION}.zip \
&& mkdir /opencv-${OPENCV_VERSION}/cmake_binary \
&& cd /opencv-${OPENCV_VERSION}/cmake_binary \
&& cmake -DBUILD_TIFF=ON \
-DBUILD_opencv_java=OFF \
-DWITH_CUDA=OFF \
-DENABLE_AVX=ON \
-DWITH_OPENGL=ON \
-DWITH_OPENCL=ON \
-DWITH_IPP=ON \
-DWITH_TBB=ON \
-DWITH_EIGEN=ON \
-DWITH_V4L=ON \
-DBUILD_TESTS=OFF \
-DBUILD_PERF_TESTS=OFF \
-DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_INSTALL_PREFIX=$(python3 -c "import sys; print(sys.prefix)") \
-DPYTHON_EXECUTABLE=$(which python3) \
-DPYTHON_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-DPYTHON_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") .. \
&& make install \
&& rm /${OPENCV_VERSION}.zip \
&& rm -r /opencv-${OPENCV_VERSION}
COPY requirements.txt ./
RUN pip install -r requirements.txt
COPY model_weights/ /model_weights/
RUN mkdir images && mkdir images/input && mkdir images/output && mkdir images/processed
COPY app/ /app/
COPY serviceAccount.json ./
WORKDIR ./app
CMD ["python","server.py"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment