-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.cpu
52 lines (37 loc) · 1.44 KB
/
Dockerfile.cpu
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
ARG BUILDER_IMAGE=ubuntu:20.04
ARG BASE_IMAGE=ubuntu:20.04
FROM $BUILDER_IMAGE AS builder
LABEL maintainer="Gustavo Montamat"
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y gnupg2 ca-certificates git build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY configure.sh /tmp/
ARG SOURCE_BRANCH=unspecified
ENV SOURCE_BRANCH $SOURCE_BRANCH
ARG SOURCE_COMMIT=unspecified
ENV SOURCE_COMMIT $SOURCE_COMMIT
ARG CONFIG
RUN git clone https://github.com/AlexeyAB/darknet.git && cd darknet \
&& git checkout $SOURCE_BRANCH \
&& git reset --hard $SOURCE_COMMIT \
&& /tmp/configure.sh $CONFIG && make \
&& cp libdarknet.so /tmp \
&& cp darknet.py /tmp \
&& cd .. && rm -rf darknet
FROM $BASE_IMAGE
LABEL maintainer="Gustavo Montamat"
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y libsm6 libxext6 libxrender-dev ffmpeg \
python3 python3-pip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir numpy opencv-python
COPY --from=builder /tmp/libdarknet.so /usr/local/darknet/libdarknet.so
COPY --from=builder /tmp/darknet.py /usr/local/darknet/darknet.py
ENV DARKNET_PATH=/usr/local/darknet
ENV PYTHONPATH "${PYTHONPATH}:/usr/local/darknet"
CMD ["python3"]