openpose-docker-python/Dockerfile

56 lines
1.8 KiB
Docker

# modified from https://hub.docker.com/r/cwaffles/openpose
FROM nvidia/cuda:11.4.0-cudnn8-devel-ubuntu20.04
#FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04
#get deps
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
python3-dev python3-pip python3-setuptools git g++ wget make libprotobuf-dev protobuf-compiler libopencv-dev \
libgoogle-glog-dev libboost-all-dev libhdf5-dev libatlas-base-dev build-essential libgflags-dev \
liblmdb-dev
RUN apt-get install -y cmake
#for python api
RUN pip3 install --upgrade pip
RUN pip3 install numpy opencv-python
#get openpose
WORKDIR /openpose
RUN git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose.git .
#build it
WORKDIR /openpose/build
RUN cmake -DBUILD_PYTHON=ON .. && make -j `nproc`
# fetch models
WORKDIR /openpose/models
RUN ./getModels.sh
# Install python
WORKDIR /openpose/build/python/openpose
RUN make install
RUN cp /openpose/build/python/openpose/pyopenpose.cpython-38-x86_64-linux-gnu.so /usr/local/lib/python3.8/dist-packages/
WORKDIR /usr/local/lib/python3.8/dist-packages
RUN ln -s pyopenpose.cpython-38-x86_64-linux-gnu.so pyopenpose
#RUN cp /openpose/build/python/openpose/pyopenpose.cpython-310-x86_64-linux-gnu.so /usr/local/lib/python3.10/dist-packages/
#WORKDIR /usr/local/lib/python3.10/dist-packages
#RUN ln -s pyopenpose.cpython-310-x86_64-linux-gnu.so pyopenpose
#ENV LD_LIBRARY_PATH=/openpose/build/python/openpose
RUN apt-get install -y ffmpeg
# Notebook to actually run code
#RUN apt-get install -y python3-notebook
RUN pip install ipywidgets --ignore-installed
RUN pip install notebook
RUN pip install ipywebrtc
EXPOSE 8888
# Possibly, use /home/user/app & set HOME to /home/user to avoid temporary directories in the app folder (if desired)
WORKDIR /app
ENV HOME /app
#CMD ["env"]
CMD ["jupyter", "notebook", "--ip", "0.0.0.0"]