This repository was archived by the owner on Apr 25, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
72 lines (58 loc) · 2.49 KB
/
Copy pathDockerfile
File metadata and controls
72 lines (58 loc) · 2.49 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
# FastFace — reproducible build container.
#
# Build: docker build -t fastface:latest .
# Test: docker run --rm fastface:latest make test
# Bench: docker run --rm fastface:latest ./fastface_int8.exe models/w600k_r50_ffw4.bin
# Shell: docker run --rm -it fastface:latest bash
#
# Note: GitHub-hosted / generic-cloud runners without AVX-VNNI still build
# and pass regression tests (accuracy bit-exact vs golden), but speed
# numbers will be slower than README's i7-13700 figures.
FROM ubuntu:24.04 AS builder
# Build toolchain + Python runtime for calibration scripts and Python SDK
RUN apt-get update && \
apt-get install -y --no-install-recommends \
gcc-13 make ca-certificates \
python3 python3-numpy python3-pil \
golang-1.22 \
&& rm -rf /var/lib/apt/lists/*
ENV CC=gcc-13
ENV PATH="/usr/lib/go-1.22/bin:${PATH}"
WORKDIR /opt/fastface
# Copy only what's needed for build (speeds up docker cache)
COPY Makefile fastface.h *.c *.py ./
COPY kernels/ ./kernels/
COPY models/*.bin ./models/
COPY tests/ ./tests/
COPY go/ ./go/
# Strip "fastface_int8.exe" .exe suffix in Makefile for Linux? No --
# Makefile uses .exe as a literal suffix; works fine on Linux (file just
# has a non-standard name, still executable).
RUN make CC=gcc-13 AR=ar all
# Regression gate: image build fails if regression test fails
RUN make PYTHON=python3 test
# Go SDK unit test (skip examples/ which need internet)
RUN cd go/fastface && go test ./...
# --- Final stage: lean runtime image ---
FROM ubuntu:24.04 AS runtime
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3 python3-numpy python3-pil libgomp1 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /opt/fastface
COPY --from=builder /opt/fastface/fastface_int8.exe .
COPY --from=builder /opt/fastface/fastface_int8_batched.exe .
COPY --from=builder /opt/fastface/libfastface.a .
COPY --from=builder /opt/fastface/fastface.h .
COPY --from=builder /opt/fastface/fastface.py .
COPY --from=builder /opt/fastface/face_match.py .
COPY --from=builder /opt/fastface/models/w600k_r50_ffw4.bin models/
COPY --from=builder /opt/fastface/models/op_scales.bin models/
COPY --from=builder /opt/fastface/models/op_scales_v2.bin models/
COPY --from=builder /opt/fastface/tests/ ./tests/
# Validate the runtime layer still works
RUN ./fastface_int8.exe models/w600k_r50_ffw4.bin --in tests/golden_input.bin \
--out /tmp/emb.bin && \
test -s /tmp/emb.bin
ENTRYPOINT []
CMD ["./fastface_int8.exe", "models/w600k_r50_ffw4.bin"]