forked from NVIDIA/VideoProcessingFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.gpu
More file actions
77 lines (58 loc) · 2.55 KB
/
Copy pathDockerfile.gpu
File metadata and controls
77 lines (58 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# syntax=docker/dockerfile:experimental
FROM docker.io/nvidia/cuda:11.2.0-cudnn8-devel-ubuntu20.04 as build
ENV POETRY_HOME="/opt/poetry" \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_VERSION=1.1.7
ENV PATH="/opt/.venv/bin:$POETRY_HOME/bin:$PATH" \
PYTHON_BINARY="/opt/.venv/bin/python"
ARG GEN_PYTORCH_EXT
RUN apt update && DEBIAN_FRONTEND=noninteractive \
apt -y install \
git wget cmake \
build-essential curl \
libavcodec-dev libavformat-dev libswscale-dev \
libxvidcore-dev x264 libx264-dev libfaac-dev \
libmp3lame-dev libtheora-dev libvorbis-dev \
python3.8 python3-pip python3.8-venv && \
rm -rf /var/lib/apt/lists/*
# https://python-poetry.org/docs/
WORKDIR $POETRY_HOME
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python3
WORKDIR /opt
COPY docker/Makefile docker/Makefile
COPY poetry.lock poetry.lock
COPY pyproject.toml pyproject.toml
# Build poetry virtual environment
# RUN if [ "$GEN_PYTORCH_EXT" = "1" ] ; then make -f docker/Makefile build_env EXTRAS=vpf-pytorch ; else make -f docker/Makefile build_env EXTRAS=vpf ; fi
RUN if [ "$GEN_PYTORCH_EXT" = "1" ] ; then make -f docker/Makefile build_env EXTRAS=vpf-dev ; else make -f docker/Makefile build_env EXTRAS=vpf ; fi
# Build vpf
COPY . .
RUN pip install -r requirements.txt
RUN make -f docker/Makefile vpf_built \
PYTHON_BINARY=$PYTHON_BINARY \
VIDEO_CODEC_SDK=/opt/Video_Codec_SDK \
GEN_PYTORCH_EXT=$GEN_PYTORCH_EXT
FROM docker.io/nvidia/cuda:11.2.0-cudnn8-runtime-ubuntu20.04
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get -y install \
git build-essential libbsd0 \
wget cmake ffmpeg libtbb-dev \
libjpeg8-dev libpng-dev libtiff-dev \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
libdc1394-22-dev libssl-dev \
libxine2-dev libv4l-dev \
libboost-all-dev libdc1394-22-dev \
python3.8 python3-pip python3.8-venv curl
WORKDIR /opt
COPY --from=build /opt/dist /opt/dist
COPY --from=build /opt/poetry /opt/poetry
# Normally we'd reinstall the enviroment but pycuda is built with cuda headers
# which are not available in the nvidia runtime image
COPY --from=build /opt/.venv /opt/.venv
COPY . .
ENV POETRY_HOME="/opt/poetry"
ENV PATH="/opt/.venv/bin:$POETRY_HOME/bin:$PATH" \
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/dist:/opt/dist/bin:/opt/.venv/lib/python3.8/site-packages/torch/lib" \
PYTHONPATH=/opt/.venv/bin:/opt/dist:/opt/dist/bin
WORKDIR /app
ENTRYPOINT ["/bin/bash"]