Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enable GPU support for Jenkins CI #462

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ pipeline {
pip install --upgrade pip
pip install scikit-build
pip install cython
pip install flake8==3.9.0 pytest==6.1.2 pytest-cov==2.11.1 mock==4.0.3 coveralls==3.0.1
pip install torch==1.10.2 torchvision==0.11.3 facenet_pytorch==2.5.2 easyocr==1.5.0
pip install -e ."[dev]"'''
}
}
Expand Down
65 changes: 21 additions & 44 deletions docker/eva_jenkins.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
# https://www.jenkins.io/doc/book/installing/docker/ - Follow these steps for starting jenkins.
FROM python:3.8
FROM nvidia/cuda:11.2.2-devel-ubuntu20.04

ENV OPENCV_VERSION="4.5.1"

# Docker image specific installation
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
python3-numpy \
python3-pip \
python3-pytest \
python3-pytest-cov \
python3-venv \
python3-yaml \
ffmpeg \
&& \
apt-get autoremove --purge -y && \
apt-get autoclean -y && \
rm -rf /var/cache/apt/* /var/lib/apt/lists/*

# OpenCV Specific Installation
RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends \
RUN apt-get -qq update && \
apt-get -qq install -y --no-install-recommends \
build-essential \
cmake \
git \
Expand All @@ -28,47 +43,9 @@ RUN apt-get -qq update \
python3-dev \
sudo \
openjdk-11-jdk \
openjdk-11-jre \
&& pip install numpy \
&& wget -q https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip -O opencv.zip \
&& unzip -qq opencv.zip -d /opt \
&& rm -rf opencv.zip \
&& cmake \
-D BUILD_TIFF=ON \
-D BUILD_opencv_java=OFF \
-D WITH_CUDA=OFF \
-D WITH_OPENGL=ON \
-D WITH_OPENCL=ON \
-D WITH_IPP=ON \
-D WITH_TBB=ON \
-D WITH_EIGEN=ON \
-D WITH_V4L=ON \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=$(python3.8 -c "import sys; print(sys.prefix)") \
-D PYTHON_EXECUTABLE=$(which python3.8) \
-D PYTHON_INCLUDE_DIR=$(python3.8 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-D PYTHON_PACKAGES_PATH=$(python3.8 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
/opt/opencv-${OPENCV_VERSION} \
&& make -j$(nproc) \
&& make install \
&& rm -rf /opt/build/* \
&& rm -rf /opt/opencv-${OPENCV_VERSION}

# Install Java11 (Direct Download) because java-8 is no longer supported
RUN wget https://download.java.net/java/ga/jdk11/openjdk-11_linux-x64_bin.tar.gz && \
mkdir /opt/jdk-11 && \
tar -zxf openjdk-11_linux-x64_bin.tar.gz -C /opt/jdk-11

# Add Jenkins user, For Spark Authentication (cannot be done without user)
RUN groupadd --gid 1000 jenkins && \
useradd --uid 1000 --gid jenkins --shell /bin/bash --home-dir /var/jenkins_home jenkins && \
mkdir /var/jenkins_home && \
chown 1000:1000 /var/jenkins_home && \
echo 'jenkins ALL=NOPASSWD: ALL' >> /etc/sudoers.d/50-jenkins && \
echo 'Defaults env_keep += "DEBIAN_FRONTEND"' >> /etc/sudoers.d/env_keep

openjdk-11-jre

# Give Permission To Home Directory To Create EVA
RUN mkdir /.eva && chmod -R 777 /.eva
RUN mkdir /.cache && chmod -R 777 /.cache
RUN mkdir /.EasyOCR && chmod -R 777 /.EasyOCR