Skip to content

Commit

Permalink
Remove cuda dev files from nvidia variants (#251)
Browse files Browse the repository at this point in the history
* nvidia nvenc/nvdec added

* remove nvidia dockerfile

* added nvidia variant template files

* Updated Dockerfiles with nvidia variant

* fix typo in condition - enable nvenc support for older versions

* update dockerfiles again

* update README

* don't copy cuda dev files in nvidia variants

* after update

Co-authored-by: Lior Amrosi <[email protected]>
Co-authored-by: shaul_myplay <7o46akCFfwLZ>
  • Loading branch information
shaulfl and Lior Amrosi authored Jul 31, 2020
1 parent 412cb4e commit 0ac3a06
Show file tree
Hide file tree
Showing 15 changed files with 1,376 additions and 11 deletions.
408 changes: 408 additions & 0 deletions docker-images/2.8/nvidia/Dockerfile

Large diffs are not rendered by default.

408 changes: 408 additions & 0 deletions docker-images/3.0/nvidia/Dockerfile

Large diffs are not rendered by default.

408 changes: 408 additions & 0 deletions docker-images/3.1/nvidia/Dockerfile

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion docker-images/3.2/nvidia1604/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,11 @@ ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64
CMD ["--help"]
ENTRYPOINT ["ffmpeg"]

COPY --from=build /usr/local /usr/local
# copy only needed files, without copying nvidia dev files
COPY --from=build /usr/local/bin /usr/local/bin/
COPY --from=build /usr/local/share /usr/local/share/
COPY --from=build /usr/local/lib /usr/local/lib/
COPY --from=build /usr/local/include /usr/local/include/

# Let's make sure the app built correctly
# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output
6 changes: 5 additions & 1 deletion docker-images/3.3/nvidia1804/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,11 @@ ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64
CMD ["--help"]
ENTRYPOINT ["ffmpeg"]

COPY --from=build /usr/local/ /usr/local/
# copy only needed files, without copying nvidia dev files
COPY --from=build /usr/local/bin /usr/local/bin/
COPY --from=build /usr/local/share /usr/local/share/
COPY --from=build /usr/local/lib /usr/local/lib/
COPY --from=build /usr/local/include /usr/local/include/

# Let's make sure the app built correctly
# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output
6 changes: 5 additions & 1 deletion docker-images/3.4/nvidia1804/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,11 @@ ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64
CMD ["--help"]
ENTRYPOINT ["ffmpeg"]

COPY --from=build /usr/local/ /usr/local/
# copy only needed files, without copying nvidia dev files
COPY --from=build /usr/local/bin /usr/local/bin/
COPY --from=build /usr/local/share /usr/local/share/
COPY --from=build /usr/local/lib /usr/local/lib/
COPY --from=build /usr/local/include /usr/local/include/

# Let's make sure the app built correctly
# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output
6 changes: 5 additions & 1 deletion docker-images/4.0/nvidia1804/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,11 @@ ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64
CMD ["--help"]
ENTRYPOINT ["ffmpeg"]

COPY --from=build /usr/local/ /usr/local/
# copy only needed files, without copying nvidia dev files
COPY --from=build /usr/local/bin /usr/local/bin/
COPY --from=build /usr/local/share /usr/local/share/
COPY --from=build /usr/local/lib /usr/local/lib/
COPY --from=build /usr/local/include /usr/local/include/

# Let's make sure the app built correctly
# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output
6 changes: 5 additions & 1 deletion docker-images/4.1/nvidia1804/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,11 @@ ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64
CMD ["--help"]
ENTRYPOINT ["ffmpeg"]

COPY --from=build /usr/local/ /usr/local/
# copy only needed files, without copying nvidia dev files
COPY --from=build /usr/local/bin /usr/local/bin/
COPY --from=build /usr/local/share /usr/local/share/
COPY --from=build /usr/local/lib /usr/local/lib/
COPY --from=build /usr/local/include /usr/local/include/

# Let's make sure the app built correctly
# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output
6 changes: 5 additions & 1 deletion docker-images/4.2/nvidia1804/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,11 @@ ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64
CMD ["--help"]
ENTRYPOINT ["ffmpeg"]

COPY --from=build /usr/local/ /usr/local/
# copy only needed files, without copying nvidia dev files
COPY --from=build /usr/local/bin /usr/local/bin/
COPY --from=build /usr/local/share /usr/local/share/
COPY --from=build /usr/local/lib /usr/local/lib/
COPY --from=build /usr/local/include /usr/local/include/

# Let's make sure the app built correctly
# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output
6 changes: 5 additions & 1 deletion docker-images/4.3/nvidia1604/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,11 @@ ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64
CMD ["--help"]
ENTRYPOINT ["ffmpeg"]

COPY --from=build /usr/local /usr/local
# copy only needed files, without copying nvidia dev files
COPY --from=build /usr/local/bin /usr/local/bin/
COPY --from=build /usr/local/share /usr/local/share/
COPY --from=build /usr/local/lib /usr/local/lib/
COPY --from=build /usr/local/include /usr/local/include/

# Let's make sure the app built correctly
# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output
6 changes: 5 additions & 1 deletion docker-images/4.3/nvidia1804/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,11 @@ ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64
CMD ["--help"]
ENTRYPOINT ["ffmpeg"]

COPY --from=build /usr/local/ /usr/local/
# copy only needed files, without copying nvidia dev files
COPY --from=build /usr/local/bin /usr/local/bin/
COPY --from=build /usr/local/share /usr/local/share/
COPY --from=build /usr/local/lib /usr/local/lib/
COPY --from=build /usr/local/include /usr/local/include/

# Let's make sure the app built correctly
# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output
6 changes: 5 additions & 1 deletion docker-images/snapshot/nvidia1804/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,11 @@ ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64
CMD ["--help"]
ENTRYPOINT ["ffmpeg"]

COPY --from=build /usr/local/ /usr/local/
# copy only needed files, without copying nvidia dev files
COPY --from=build /usr/local/bin /usr/local/bin/
COPY --from=build /usr/local/share /usr/local/share/
COPY --from=build /usr/local/lib /usr/local/lib/
COPY --from=build /usr/local/include /usr/local/include/

# Let's make sure the app built correctly
# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output
97 changes: 97 additions & 0 deletions templates/Dockerfile-template.nvidia
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# ffmpeg - http://ffmpeg.org/download.html
#
# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
#
# https://hub.docker.com/r/jrottenberg/ffmpeg/
#
#

FROM nvidia/cudagl:9.2-devel-ubuntu18.04 AS devel-base

ENV NVIDIA_DRIVER_CAPABILITIES compat32,compute,video
WORKDIR /tmp/workdir

RUN apt-get -yqq update && \
apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 && \
apt-get autoremove -y && \
apt-get clean -y

FROM nvidia/cudagl:9.2-runtime-ubuntu18.04 AS runtime-base

ENV NVIDIA_DRIVER_CAPABILITIES compat32,compute,video
WORKDIR /tmp/workdir

RUN apt-get -yqq update && \
apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 libxcb-shape0-dev && \
apt-get autoremove -y && \
apt-get clean -y


FROM devel-base as build

ENV NVIDIA_HEADERS_VERSION=8.1.24.9
ARG PKG_CONFIG_PATH=/opt/ffmpeg/lib/pkgconfig
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/ffmpeg/lib"
ARG PREFIX=/opt/ffmpeg
ARG MAKEFLAGS="-j12"

ENV %%ENV%%

RUN buildDeps="autoconf \
automake \
cmake \
curl \
bzip2 \
libexpat1-dev \
g++ \
gcc \
git \
gperf \
libtool \
make \
nasm \
perl \
pkg-config \
python \
libssl-dev \
yasm \
zlib1g-dev" && \
apt-get -yqq update && \
apt-get install -yq --no-install-recommends ${buildDeps}

RUN \
DIR=/tmp/nv-codec-headers && \
git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git ${DIR} && \
cd ${DIR} && \
git checkout n${NVIDIA_HEADERS_VERSION} && \
sed -i 's@/usr/local@'"$PREFIX"'@' Makefile && \
make && \
make install && \
rm -rf ${DIR}

%%RUN%%
## cleanup
RUN \
ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \
cp ${PREFIX}/bin/* /usr/local/bin/ && \
cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \
LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf



FROM runtime-base AS release
MAINTAINER Julien Rottenberg <[email protected]>

CMD ["--help"]
ENTRYPOINT ["ffmpeg"]
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"

# copy only needed files, without copying nvidia dev files
COPY --from=build /usr/local/bin /usr/local/bin/
COPY --from=build /usr/local/share /usr/local/share/
COPY --from=build /usr/local/lib /usr/local/lib/
COPY --from=build /usr/local/include /usr/local/include/

# Let's make sure the app built correctly
# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output

6 changes: 5 additions & 1 deletion templates/Dockerfile-template.nvidia1604
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64
CMD ["--help"]
ENTRYPOINT ["ffmpeg"]

COPY --from=build /usr/local /usr/local
# copy only needed files, without copying nvidia dev files
COPY --from=build /usr/local/bin /usr/local/bin/
COPY --from=build /usr/local/share /usr/local/share/
COPY --from=build /usr/local/lib /usr/local/lib/
COPY --from=build /usr/local/include /usr/local/include/

# Let's make sure the app built correctly
# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output
6 changes: 5 additions & 1 deletion templates/Dockerfile-template.nvidia1804
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64
CMD ["--help"]
ENTRYPOINT ["ffmpeg"]

COPY --from=build /usr/local/ /usr/local/
# copy only needed files, without copying nvidia dev files
COPY --from=build /usr/local/bin /usr/local/bin/
COPY --from=build /usr/local/share /usr/local/share/
COPY --from=build /usr/local/lib /usr/local/lib/
COPY --from=build /usr/local/include /usr/local/include/

# Let's make sure the app built correctly
# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output

0 comments on commit 0ac3a06

Please sign in to comment.