voice_audio_multi/.devops/vulkan.Dockerfile
Fabio c36510c21e
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
Initial import: audio.cpp with Orange Pi documentation
2026-11-04 19:05:22 +01:00

116 lines
4 KiB
Docker

# audio.cpp — Vulkan Dockerfile
#
# Usage:
# docker build -f .devops/vulkan.Dockerfile -t local/audiocpp:full-vulkan .
# ── BUILD: Compile all release binaries with Vulkan ──────────────────────────
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 and Vulkan shader/compiler headers.
RUN apt-get update && \
apt-get install -y --no-install-recommends \
gcc-${GCC_VERSION} g++-${GCC_VERSION} make cmake libgomp1 ca-certificates \
glslc libvulkan-dev spirv-headers \
libxcb-xinput0 libxcb-xinerama0 libxcb-cursor-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
ENV CC=gcc-${GCC_VERSION} CXX=g++-${GCC_VERSION}
WORKDIR /app
COPY . .
# Validate architecture (Vulkan 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=ON \
-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 + Vulkan runtime 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, Vulkan loader/Mesa ICDs, 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 libvulkan1 mesa-vulkan-drivers \
libglvnd0 libgl1 libglx0 libegl1 libgles2 \
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"]