-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
156 lines (135 loc) · 6.14 KB
/
Dockerfile
File metadata and controls
156 lines (135 loc) · 6.14 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
FROM ubuntu:22.04 AS build
SHELL ["/bin/bash", "-c"]
ENV DEBIAN_FRONTEND=noninteractive
RUN set -e && \
apt update && apt upgrade -y; \
apt -y install git less vim g++ curl libopencv-dev libjsoncpp-dev qtbase5-dev build-essential libssl-dev libdb-dev libdb++-dev libopenjp2-7 libopenjp2-tools libpcsclite-dev libssl-dev libopenjp2-7-dev libjpeg-dev libpng-dev libtiff-dev zlib1g-dev libopenmpi-dev libdb++-dev libsqlite3-dev libhwloc-dev libavcodec-dev libavformat-dev libswscale-dev; \
strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so; \
curl -L -O https://github.com/Kitware/CMake/releases/download/v3.29.1/cmake-3.29.1-linux-x86_64.sh; \
chmod +x cmake*.sh; mkdir /opt/cmake; ./cmake*.sh --prefix=/opt/cmake --skip-license; ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake;\
mkdir /app 2>/dev/null || true; \
cd /app; \
git clone --verbose https://github.com/mitre/biqt --branch master biqt-pub; \
export NUM_CORES=$(cat /proc/cpuinfo | grep -Pc "processor\s*:\s*[0-9]+\s*$"); \
echo "Builds will use ${NUM_CORES} core(s)."; \
cd /app/biqt-pub; \
mkdir build; \
cd build; \
cmake -DBUILD_TARGET=UBUNTU -DCMAKE_BUILD_TYPE=Release -DWITH_JAVA=OFF ..; \
make -j${NUM_CORES}; \
make install; \
source /etc/profile.d/biqt.sh; \
cd /app; git clone https://github.com/mitre/biqt-iris.git; \
cd /app/biqt-iris; \
mkdir build; \
cd build; \
cmake -DBIQT_HOME=/usr/local/share/biqt -DCMAKE_BUILD_TYPE=Release ..; \
make -j${NUM_CORES}; \
make install; \
cd /app; \
git clone https://github.com/biometrics/openbr.git openbr || exit 5; \
cd /app/openbr; \
git checkout 1e1c8f; \
mkdir build; \
cd build; \
cmake -DCMAKE_BUILD_TYPE=Release -DBR_WITH_OPENCV_NONFREE=OFF -DCMAKE_INSTALL_PREFIX=/opt/openbr ..; \
export NUM_CORES=$(cat /proc/cpuinfo | grep -Pc "processor\s*:\s*[0-9]+\s*$"); \
make -j${NUM_CORES}; \
make install; \
cd /app; \
git clone https://github.com/mitre/biqt-face.git biqt-face --depth=1 --branch master; \
cd /app/biqt-face; \
mkdir build; \
cd build; \
cmake -DCMAKE_BUILD_TYPE=Release -DOPENBR_DIR=/opt/openbr ..; \
make -j${NUM_CORES}; \
make install; \
cd /app; \
git clone --recursive https://github.com/usnistgov/NFIQ2.git; \
cd NFIQ2; \
git checkout 76b8c4e0b0541f3deab832b1a496e524edc0b5b6; \
mkdir build; \
cd build; \
cmake .. -DCMAKE_CONFIGURATION_TYPES=Release; \
cmake --build . --config Release; \
cmake --install .
RUN apt install -y python3-pip liblapack-dev; \
pip install conan cmake; \
cd /app; mkdir ofiq; cd ofiq; \
git clone https://github.com/BSI-OFIQ/OFIQ-Project.git; \
cd OFIQ-Project; \
git checkout d589ca27896a472446abc9eca8b62947ee47db19; \
cd scripts; \
chmod +x *.sh; \
./build.sh
# ARG BIQT_CONTACT_DETECTOR_COMMIT=master
# ENV BIQT_CONTACT_DETECTOR_COMMIT ${BIQT_CONTACT_DETECTOR_COMMIT}
# # Stage 3: BIQT Contact Detector
# RUN set -e; \
# source /etc/profile.d/biqt.sh; \
# if [ "${WITH_BIQT_CONTACT_DETECTOR}" == "ON" ]; then \
# ( mkdir /app 2>/dev/null || true ); \
# cd /app; \
# git clone https://github.com/mitre/biqt-contact-detector biqt-contact-detector --branch "${BIQT_CONTACT_DETECTOR_COMMIT}" --depth 1; \
# cd biqt-contact-detector; \
# pip install -r requirements.txt; \
# export NUM_CORES=$(cat /proc/cpuinfo | grep -Pc "processor\s*:\s*[0-9]+\s*$"); \
# mkdir build; \
# cd build; \
# cmake -DCMAKE_BUILD_TYPE=Release ..; \
# make -j${NUM_CORES}; \
# make install; \
# fi;
FROM ubuntu:22.04 AS release
WORKDIR /app
COPY --from=build /usr/local /usr/local
COPY --from=build /etc/profile.d/biqt.sh /etc/profile.d/biqt.sh
COPY --from=build /opt/openbr /opt/openbr
COPY --from=build /usr/lib /usr/lib
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=off
ENV MPLCONFIGDIR=/app/temp
# ENV RAY_USE_MULTIPROCESSING_CPU_COUNT=1
ENV RAY_DISABLE_DOCKER_CPU_WARNING=1
ENV YDATA_PROFILING_NO_ANALYTICS=True
# ENV YOLO_CONFIG_DIR=/tmp/yolo
ENV DEBIAN_FRONTEND=noninteractive
ENV OPENCV_LOG_LEVEL=ERROR
ENV NUMBA_CACHE_DIR=/tmp
COPY bqat/bqat_core/misc/BQAT /app/BQAT/
COPY bqat/bqat_core/misc/NISQA /app/NISQA/
COPY bqat/bqat_core/misc/OFIQ /app/OFIQ/
COPY Pipfile Pipfile.lock /app/
COPY tests /app/tests/
RUN apt update && apt -y install curl ca-certificates libblas-dev liblapack-dev python3-pip libsndfile1; \
python3 -m pip install pipenv && \
if [ "${DEV}" == "true" ]; \
then pipenv requirements --dev > requirements.txt; \
else pipenv requirements > requirements.txt; \
fi; \
python3 -m pip uninstall -y pipenv && \
python3 -m pip install -r requirements.txt; \
python3 -m pip cache purge; python3 -m compileall .; \
rm -rf /var/lib/apt/lists/*
# RUN mkdir -p /root/.deepface/weights && \
# wget https://github.com/serengil/deepface_models/releases/download/v1.0/facial_expression_model_weights.h5 -P /root/.deepface/weights/ && \
# wget https://github.com/serengil/deepface_models/releases/download/v1.0/age_model_weights.h5 -P /root/.deepface/weights/ && \
# wget https://github.com/serengil/deepface_models/releases/download/v1.0/gender_model_weights.h5 -P /root/.deepface/weights/ && \
# wget https://github.com/serengil/deepface_models/releases/download/v1.0/race_model_single_batch.h5 -P /root/.deepface/weights/
RUN mkdir data
COPY bqat bqat/
COPY api api/
COPY api/favicon.png .
COPY --from=build /app/ofiq/OFIQ-Project/install_x86_64_linux/Release/bin ./OFIQ/bin
COPY --from=build /app/ofiq/OFIQ-Project/install_x86_64_linux/Release/lib ./OFIQ/lib
COPY --from=build /app/ofiq/OFIQ-Project/data/models ./OFIQ/models
ARG VER_CORE
ARG VER_API
LABEL BQAT.core.version=$VER_CORE
LABEL BQAT.api.version=$VER_API
HEALTHCHECK --interval=5m --timeout=5m CMD curl -f -s http://localhost:8848/info || sleep 30 && curl -f -s http://localhost:8848/info || sleep 30 && curl -f -s http://localhost:8848/info || kill -9 1
# RUN groupadd -r appgroup && useradd -r -g appgroup assessor && chown -R assessor /app && chown -R assessor /usr/local
# USER assessor
ENTRYPOINT [ "/bin/bash", "-l", "-c" ]
CMD [ "python3 -m api" ]