Some checks failed
Linux Build / Linux cpu (push) Has been cancelled
Linux Build / Linux cpu-clang (push) Has been cancelled
Linux Build / Linux vulkan (push) Has been cancelled
mac-build / macOS CPU (push) Has been cancelled
Nix Build / Nix (cpu) (push) Has been cancelled
Nix Build / Nix (vulkan) (push) Has been cancelled
windows-build / Windows CPU (push) Has been cancelled
112 lines
3.8 KiB
Docker
112 lines
3.8 KiB
Docker
# 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"]
|