Skip to content

Commit

Permalink
docker build for CentOS7 with NVidia GPU
Browse files Browse the repository at this point in the history
  • Loading branch information
sflow committed Oct 18, 2019
1 parent 5f6438b commit 8ea9c4e
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
13 changes: 13 additions & 0 deletions docker_build/centos7nvml/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM nvidia/cuda:10.1-devel-centos7 as builder
RUN echo "UPDATE" && yum -y update
RUN echo "DEVTOOLS" && yum -y install \
git \
gcc \
make \
rpm-build
RUN echo "EXTRAS" && yum -y install \
libpcap-devel \
openssl-devel
RUN mkdir /packages && chown 777 /packages
COPY build_hsflowd /root/build_hsflowd
ENTRYPOINT ["/root/build_hsflowd"]
17 changes: 17 additions & 0 deletions docker_build/centos7nvml/build_hsflowd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
echo "build_hsflowd on platform: $1"
echo "with Nvidia NVML extension"

git clone https://github.com/sflow/host-sflow \
&& cd host-sflow \
&& make rpm FEATURES="PCAP TCP DOCKER NVML"

echo "=== ldd check ========="
ldd src/Linux/mod_nvml.so
echo "======================="

for rpm in `ls *.rpm`; do cp "$rpm" "/packages/${rpm/hsflowd/hsflowd-$1}"; done
echo ""
echo "files in /packages:"
ls -l /packages

22 changes: 22 additions & 0 deletions docker_build_and_run/centos7nvml/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM nvidia/cuda:10.1-devel-centos7 as builder
RUN echo "UPDATE" && yum -y update
RUN echo "DEVTOOLS" && yum -y install \
git \
gcc \
make
RUN echo "EXTRAS" && yum -y install \
libpcap-devel \
openssl-devel
RUN git clone https://github.com/sflow/host-sflow \
&& cd host-sflow \
&& make all install FEATURES="PCAP TCP DOCKER NVML"

FROM nvidia/cuda:10.1-runtime-centos7
RUN echo "UPDATE" && yum -y update
RUN echo "EXTRAS" && yum -y install \
libpcap \
openssl
COPY --from=builder /usr/sbin/hsflowd /usr/sbin/hsflowd
COPY --from=builder /etc/hsflowd.conf /etc/hsflowd.conf
COPY --from=builder /etc/hsflowd/modules/* /etc/hsflowd/modules/
CMD /usr/sbin/hsflowd -m `uuidgen` -d
2 changes: 1 addition & 1 deletion docker_build_on
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ PLATFORM="$1"
DK="docker_build/$PLATFORM"

docker build -t $DK $DK
docker run --privileged=true -v ${PWD}/docker_build_packages/:/packages $DK $PLATFORM
docker run --privileged=true --rm -v ${PWD}/docker_build_packages/:/packages $DK $PLATFORM

0 comments on commit 8ea9c4e

Please sign in to comment.