-
Notifications
You must be signed in to change notification settings - Fork 0
/
dockerfile
42 lines (34 loc) · 1004 Bytes
/
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
FROM alpine:latest
WORKDIR /app
# 安装依赖库和构建工具
RUN set -eux && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
apk update && \
apk add --no-cache build-base cmake git sqlite-dev
# 克隆dlib源代码并构建
RUN git clone -b 'v19.24.2' --single-branch https://mirror.ghproxy.com/https://github.com/davisking/dlib.git && \
cd dlib && \
mkdir build && \
cd build && \
cmake .. -DUSE_AVX_INSTRUCTIONS=1 -DUSE_SSE4_INSTRUCTIONS=1 && \
cmake --build . --config Release && \
make install && \
cd ../.. && \
rm -rf dlib
# 复制代码文件到工作目录
COPY . /app/build
# 编译代码
RUN cd build && \
mkdir build && \
cd build && \
cmake .. && \
make
# 清理文件
RUN mv /app/build/build/face_rec /app/face_rec && \
mv /app/build/model /app/model && \
cd /app && \
mkdir data && \
rm -rf /app/build
# 暴露服务端口
EXPOSE 8080
# 运行服务
CMD ["/app/face_rec"]