cube-studio/job-template/job/object_detection_on_darknet/Dockerfile-gpu-cv
2022-06-06 16:47:43 +08:00

69 lines
2.0 KiB
Plaintext

ARG BASE_IMAGE=nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04
FROM $BASE_IMAGE AS builder
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y gnupg2 ca-certificates \
git build-essential libopencv-dev \
&& rm -rf /var/lib/apt/lists/*
COPY configure.sh /tmp/
ARG SOURCE_BRANCH=master
ENV SOURCE_BRANCH $SOURCE_BRANCH
ARG CONFIG="gpu-cv"
RUN git clone https://github.com/AlexeyAB/darknet.git && cd darknet \
&& git checkout $SOURCE_BRANCH \
&& /tmp/configure.sh $CONFIG && make \
&& cp darknet /usr/local/bin \
&& cd .. && rm -rf darknet
FROM nvidia/cuda:11.2.2-cudnn8-runtime-ubuntu20.04
ENV DEBIAN_FRONTEND noninteractive
RUN echo "deb http:// focal main universe" >> /etc/apt/sources.list
RUN apt-get update
RUN apt-get install --no-install-recommends --no-install-suggests -y libopencv-highgui4.2 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/bin/darknet /usr/local/bin/darknet
# Install python 3.8.
RUN apt-get update && apt-get install -y apt-file && apt-file update && apt-get install -y software-properties-common curl
RUN add-apt-repository ppa:deadsnakes/ppa && apt-get update && apt-get install -y \
python3.8 python3.8-dev python3-pip python3.8-venv && \
rm -rf /var/lib/apt/lists/* && \
python3.8 -m pip install pip --upgrade && \
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 0
# Make python3.8 the default python version
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 0
RUN curl -fSsL -O https://bootstrap.pypa.io/get-pip.py && \
python3 get-pip.py && \
rm get-pip.py
RUN pip3 --no-cache-dir install \
future>=0.17.1 \
grpcio \
h5py \
keras_applications>=1.0.8 \
keras_preprocessing>=1.1.0 \
mock \
numpy \
portpicker \
requests \
--ignore-installed six>=1.12.0
WORKDIR /app
COPY setup_args.py /app
COPY launcher.sh /app
RUN chmod 777 launcher.sh && mkdir backup
ENTRYPOINT ["./launcher.sh"]