Repository navigation
Expand file tree
/
Copy pathcpu.Dockerfile
More file actions
112 lines (91 loc) · 3.77 KB
/
Copy pathcpu.Dockerfile
File metadata and controls
112 lines (91 loc) · 3.77 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
# audio.cpp — CPU Dockerfile
#
# Usage:
# docker build -f .devops/cpu.Dockerfile -t local/audiocpp:full-cpu .
# ── BUILD: Compile all release binaries ───────────────────────────────────────
ARG UBUNTU_VERSION=24.04
ARG BUILD_DATE=N/A
ARG APP_VERSION=N/A
ARG APP_REVISION=N/A
ARG GCC_VERSION=14
FROM docker.io/ubuntu:$UBUNTU_VERSION AS build
ARG GCC_VERSION=14
ARG AUDIOCPP_VERSION=dev
# Install build toolchain
RUN apt-get update && \
apt-get install -y --no-install-recommends \
gcc-${GCC_VERSION} g++-${GCC_VERSION} make cmake libgomp1 ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
ENV CC=gcc-${GCC_VERSION} CXX=g++-${GCC_VERSION}
WORKDIR /app
COPY . .
# Validate architecture (CPU backend is only supported on amd64 and arm64)
ARG TARGETARCH=amd64
RUN if [ "$TARGETARCH" = "amd64" ] || [ "$TARGETARCH" = "arm64" ]; then \
echo "Building for $TARGETARCH"; \
else \
echo "Unsupported architecture: $TARGETARCH"; \
exit 1; \
fi
# Configure and build
RUN cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DAUDIOCPP_MODEL_SET=full \
-DENGINE_ENABLE_CPU_ALL_VARIANTS=ON \
-DENGINE_ENABLE_CUDA=OFF \
-DENGINE_ENABLE_VULKAN=OFF \
-DENGINE_ENABLE_OPENMP=ON \
-DAUDIOCPP_BUILD_NATIVE_MODEL_MANAGER=ON \
-DAUDIOCPP_VERSION="${AUDIOCPP_VERSION}" \
-DENGINE_BUILD_EXAMPLES=OFF \
-DENGINE_BUILD_TESTS=OFF \
-DENGINE_BUILD_WARMBENCH=OFF && \
cmake --build build --parallel $(nproc) \
--target audiocpp_cli \
--target audiocpp_server \
--target audiocpp_model_manager \
--target model_perf
# Collect shared libraries
RUN mkdir -p /app/lib && \
find build -name "*.so*" -exec cp -P {} /app/lib \;
# Collect binaries + multiplexer into /app/full
RUN mkdir -p /app/full && \
cp build/bin/audiocpp_cli build/bin/audiocpp_server build/bin/audiocpp_model_manager \
build/bin/model_perf /app/full/ && \
cp .devops/entrypoint.sh /app/full/entrypoint.sh && \
chmod +x /app/full/entrypoint.sh
# ── BASE: Shared runtime (OS + common libs) ───────────────────────────────────
FROM docker.io/ubuntu:$UBUNTU_VERSION AS base
ARG BUILD_DATE=N/A
ARG APP_VERSION=N/A
ARG APP_REVISION=N/A
ARG IMAGE_URL=N/A
ARG IMAGE_SOURCE=N/A
LABEL org.opencontainers.image.created=$BUILD_DATE \
org.opencontainers.image.version=$APP_VERSION \
org.opencontainers.image.revision=$APP_REVISION \
org.opencontainers.image.title="audio.cpp" \
org.opencontainers.image.description="An all-in-one, pure C++ inference engine for audio models, powered by ggml" \
org.opencontainers.image.url=$IMAGE_URL \
org.opencontainers.image.source=$IMAGE_SOURCE
# Runtime deps: OpenMP threading, curl (healthcheck), ffmpeg (audio I/O),
# python3 for the native WebUI's spec-backed model installer.
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libgomp1 curl ffmpeg python3 ca-certificates && \
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /tmp/* /var/tmp/* && \
find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete && \
find /var/cache -type f -delete
COPY --from=build /app/lib/ /app
WORKDIR /app
# ── FULL: All binaries + entrypoint.sh multiplexer ────────────────────────────
FROM base AS full
COPY --from=build /app/full /app
COPY model_specs/ /app/model_specs/
COPY tools/model_manager_v2.py /app/tools/model_manager_v2.py
RUN mkdir -p /app/models && chown ubuntu:ubuntu /app/models
USER ubuntu
ENTRYPOINT ["/app/entrypoint.sh"]