forked from ageitgey/face_recognition
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
74 lines (65 loc) · 1.89 KB
/
Dockerfile
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Builder Image
FROM python:3.8-slim-buster AS compile
# Install Dependencies
RUN apt-get -y update && apt-get install -y --fix-missing \
build-essential \
cmake \
gfortran \
git \
wget \
curl \
graphicsmagick \
libgraphicsmagick1-dev \
libatlas-base-dev \
libavcodec-dev \
libavformat-dev \
libgtk2.0-dev \
libjpeg-dev \
liblapack-dev \
libswscale-dev \
pkg-config \
python3-dev \
python3-numpy \
software-properties-common \
zip \
&& apt-get clean && rm -rf /tmp/* /var/tmp/*
# Virtual Environment
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Install Dlib
ENV CFLAGS=-static
RUN pip3 install --upgrade pip && \
git clone -b 'v19.21' --single-branch https://github.com/davisking/dlib.git && \
cd dlib/ && \
python3 setup.py install --set BUILD_SHARED_LIBS=OFF
RUN pip3 install face_recognition
# Runtime Image
FROM python:3.8-slim-buster
COPY --from=compile /opt/venv /opt/venv
COPY --from=compile \
# Sources
/lib/x86_64-linux-gnu/libpthread.so.0 \
/lib/x86_64-linux-gnu/libz.so.1 \
/lib/x86_64-linux-gnu/libm.so.6 \
/lib/x86_64-linux-gnu/libgcc_s.so.1 \
/lib/x86_64-linux-gnu/libc.so.6 \
/lib/x86_64-linux-gnu/libdl.so.2 \
/lib/x86_64-linux-gnu/librt.so.1 \
# Destination
/lib/x86_64-linux-gnu/
COPY --from=compile \
# Sources
/usr/lib/x86_64-linux-gnu/libX11.so.6 \
/usr/lib/x86_64-linux-gnu/libXext.so.6 \
/usr/lib/x86_64-linux-gnu/libpng16.so.16 \
/usr/lib/x86_64-linux-gnu/libjpeg.so.62 \
/usr/lib/x86_64-linux-gnu/libstdc++.so.6 \
/usr/lib/x86_64-linux-gnu/libxcb.so.1 \
/usr/lib/x86_64-linux-gnu/libXau.so.6 \
/usr/lib/x86_64-linux-gnu/libXdmcp.so.6 \
/usr/lib/x86_64-linux-gnu/libbsd.so.0 \
# Destination
/usr/lib/x86_64-linux-gnu/
# Add our packages
ENV PATH="/opt/venv/bin:$PATH"